添加子平台用户角色作为普通用户

This commit is contained in:
Li Jianxuan 2014-06-13 08:07:29 +00:00
parent 7ca5d8b07b
commit 6b34db402c
1 changed files with 141 additions and 125 deletions

View File

@ -11,6 +11,17 @@ use Helpers\View as view;
private $_authController = array('module'=>'','controller' => 'account', private $_authController = array('module'=>'','controller' => 'account',
'action' => 'login'); 'action' => 'login');
private $roles = array(
'系统管理员' => 'administrator',
'青海省气象科学研究所' => 'meteorologic',
'青海省环境监测中心站' => 'qhemc',
'青海省水土保持局' => 'watersoil',
'青海省林业调查规划院' => 'forestry',
'青海省水文水资源局' => 'hydrology',
'青海省草原总站' => 'grassland',
'青海省生态环境遥感监测中心' => 'qherc'
);
public function __construct(Zend_Auth $auth) public function __construct(Zend_Auth $auth)
{ {
$this->db=Zend_Registry::get('db'); $this->db=Zend_Registry::get('db');
@ -19,7 +30,12 @@ use Helpers\View as view;
// add the different user roles // add the different user roles
$this->acl->addRole(new Zend_Acl_Role($this->_defaultRole)); $this->acl->addRole(new Zend_Acl_Role($this->_defaultRole));
$this->acl->addRole(new Zend_Acl_Role('member')); $this->acl->addRole(new Zend_Acl_Role('member'));
$this->acl->addRole(new Zend_Acl_Role('administrator'), 'member');
foreach($this->roles as $k=>$v)
{
$this->acl->addRole(new Zend_Acl_Role($v), 'member');
}
// add the resources we want to have control over // add the resources we want to have control over
$this->acl->add(new Zend_Acl_Resource('account')); $this->acl->add(new Zend_Acl_Resource('account'));
$this->acl->add(new Zend_Acl_Resource('data')); $this->acl->add(new Zend_Acl_Resource('data'));