version 1.1.1.1.2.1, 2007/11/13 07:36:19
|
version 1.1.1.1.2.2, 2007/11/15 15:31:35
|
Line 24
|
Line 24
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
# |
# |
# $Paefchen$ | # $Paefchen: FreeBSD/tinderbox/webui/module/moduleUsers.php,v 1.1.1.1.2.1 2007/11/13 07:36:19 as Exp $ |
# $MCom: portstools/tinderbox/webui/module/moduleUsers.php,v 1.18 2007/10/13 02:28:48 ade Exp $ |
# $MCom: portstools/tinderbox/webui/module/moduleUsers.php,v 1.18 2007/10/13 02:28:48 ade Exp $ |
# |
# |
|
|
class moduleUsers extends module { | class moduleUsers extends moduleSession { |
|
|
private $permissions = null; |
private $permissions = null; |
private $moduleBuilds = null; |
private $moduleBuilds = null; |
Line 39 class moduleUsers extends module {
|
Line 39 class moduleUsers extends module {
|
} |
} |
|
|
public function display_login() { |
public function display_login() { |
global $moduleSession; |
|
|
|
if( $this->is_logged_in() ) { |
if( $this->is_logged_in() ) { |
$user = $moduleSession->getAttribute( 'user' ); | $user = $this->getAttribute( 'user' ); |
$this->template_assign( 'user_name', $user->getName() ); |
$this->template_assign( 'user_name', $user->getName() ); |
$this->template_assign( 'user_id', $user->getId() ); |
$this->template_assign( 'user_id', $user->getId() ); |
if( $this->checkWwwAdmin() ) { |
if( $this->checkWwwAdmin() ) { |
Line 207 class moduleUsers extends module {
|
Line 205 class moduleUsers extends module {
|
} |
} |
|
|
public function do_login( $username, $password ) { |
public function do_login( $username, $password ) { |
global $moduleSession; |
|
|
|
$user = $this->TinderboxDS->getUserByLogin( $username, $password ); |
$user = $this->TinderboxDS->getUserByLogin( $username, $password ); |
if( $user ) { |
if( $user ) { |
if( $user->getWwwEnabled() ) { |
if( $user->getWwwEnabled() ) { |
$moduleSession->setAttribute( 'user', $user ); | $this->setAttribute( 'user', $user ); |
return true; |
return true; |
} else { |
} else { |
$this->TinderboxDS->addError( user_login_not_enabled ); |
$this->TinderboxDS->addError( user_login_not_enabled ); |
Line 225 class moduleUsers extends module {
|
Line 221 class moduleUsers extends module {
|
} |
} |
|
|
public function do_logout() { |
public function do_logout() { |
global $moduleSession; | $this->removeAttribute( 'user' ); |
| $this->destroy(); |
|
|
$moduleSession->removeAttribute( 'user' ); |
|
$moduleSession->destroy(); |
|
|
|
return true; |
return true; |
} |
} |
|
|
public function is_logged_in() { |
public function is_logged_in() { |
global $moduleSession; | $user = $this->getAttribute( 'user' ); |
|
|
$user = $moduleSession->getAttribute( 'user' ); |
|
|
|
if( is_object( $user ) && $user->getWwwEnabled() == 1 ) { |
if( is_object( $user ) && $user->getWwwEnabled() == 1 ) { |
return true; |
return true; |
} |
} |
Line 245 class moduleUsers extends module {
|
Line 237 class moduleUsers extends module {
|
} |
} |
|
|
public function get_www_enabled() { |
public function get_www_enabled() { |
global $moduleSession; | $user = $this->getAttribute( 'user' ); |
$user = $moduleSession->getAttribute( 'user' ); | |
|
|
$userobj = $this->TinderboxDS->getUserById( $user->getId() ); |
$userobj = $this->TinderboxDS->getUserById( $user->getId() ); |
if( is_object( $userobj ) ) { |
if( is_object( $userobj ) ) { |
Line 257 class moduleUsers extends module {
|
Line 248 class moduleUsers extends module {
|
} |
} |
|
|
public function get_id() { |
public function get_id() { |
global $moduleSession; | $user = $this->getAttribute( 'user' ); |
$user = $moduleSession->getAttribute( 'user' ); | |
|
|
return $user->getId(); |
return $user->getId(); |
} |
} |
Line 273 class moduleUsers extends module {
|
Line 263 class moduleUsers extends module {
|
} |
} |
|
|
public function fetch_permissions( $object_type, $object_id ) { |
public function fetch_permissions( $object_type, $object_id ) { |
global $moduleSession; |
|
|
|
if( $this->is_logged_in() ) { |
if( $this->is_logged_in() ) { |
$user = $moduleSession->getAttribute( 'user' ); | $user = $this->getAttribute( 'user' ); |
foreach( $this->TinderboxDS->getUserPermissions( $user->getId(), $object_type, $object_id ) as $perm ) { |
foreach( $this->TinderboxDS->getUserPermissions( $user->getId(), $object_type, $object_id ) as $perm ) { |
$this->permissions[$object_type][$object_id][$perm['user_permission']] = 1; |
$this->permissions[$object_type][$object_id][$perm['user_permission']] = 1; |
} |
} |