--- FreeBSD/tinderbox/webui/module/moduleUsers.php 2007/11/13 07:36:19 1.1.1.1.2.1 +++ FreeBSD/tinderbox/webui/module/moduleUsers.php 2007/11/15 15:31:35 1.1.1.1.2.2 @@ -24,11 +24,11 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # 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 $ # -class moduleUsers extends module { +class moduleUsers extends moduleSession { private $permissions = null; private $moduleBuilds = null; @@ -39,10 +39,8 @@ class moduleUsers extends module { } public function display_login() { - global $moduleSession; - if( $this->is_logged_in() ) { - $user = $moduleSession->getAttribute( 'user' ); + $user = $this->getAttribute( 'user' ); $this->template_assign( 'user_name', $user->getName() ); $this->template_assign( 'user_id', $user->getId() ); if( $this->checkWwwAdmin() ) { @@ -207,12 +205,10 @@ class moduleUsers extends module { } public function do_login( $username, $password ) { - global $moduleSession; - $user = $this->TinderboxDS->getUserByLogin( $username, $password ); if( $user ) { if( $user->getWwwEnabled() ) { - $moduleSession->setAttribute( 'user', $user ); + $this->setAttribute( 'user', $user ); return true; } else { $this->TinderboxDS->addError( user_login_not_enabled ); @@ -225,19 +221,15 @@ class moduleUsers extends module { } public function do_logout() { - global $moduleSession; + $this->removeAttribute( 'user' ); + $this->destroy(); - $moduleSession->removeAttribute( 'user' ); - $moduleSession->destroy(); - return true; } public function is_logged_in() { - global $moduleSession; + $user = $this->getAttribute( 'user' ); - $user = $moduleSession->getAttribute( 'user' ); - if( is_object( $user ) && $user->getWwwEnabled() == 1 ) { return true; } @@ -245,8 +237,7 @@ class moduleUsers extends module { } public function get_www_enabled() { - global $moduleSession; - $user = $moduleSession->getAttribute( 'user' ); + $user = $this->getAttribute( 'user' ); $userobj = $this->TinderboxDS->getUserById( $user->getId() ); if( is_object( $userobj ) ) { @@ -257,8 +248,7 @@ class moduleUsers extends module { } public function get_id() { - global $moduleSession; - $user = $moduleSession->getAttribute( 'user' ); + $user = $this->getAttribute( 'user' ); return $user->getId(); } @@ -273,10 +263,9 @@ class moduleUsers extends module { } public function fetch_permissions( $object_type, $object_id ) { - global $moduleSession; 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 ) { $this->permissions[$object_type][$object_id][$perm['user_permission']] = 1; }