-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.php
42 lines (38 loc) · 971 Bytes
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* User class, connecting users to roles through getGroups() method
* @package Auth
* @subpackage User
*/
/**
* @package Auth
* @subpackage User
* @copyright Copyright (c) 2009 ZooCMS
* @version 1.0
*/
class Auth_User extends Zend_Db_Table_Row_Abstract{
protected $groups = array();
/**
* Get array of group names/role ids
*
* @return Array Acl_Role objects
*/
public function getGroups($update = false) {
if (!$this->groups) {
if (!$update && isset($_SESSION['user_groups'])) {
$this->groups = $_SESSION['user_groups'];
}
else {
$this->groups = Zoo::getService('acl')->getGroups($this->id);
$_SESSION['user_groups'] = $this->groups;
}
}
return $this->groups;
}
/**
* Logout the user
*/
public function logout() {
unset($_SESSION['user_groups']);
}
}