Example #1
0
 /**
  * Get role resources with "allow" permission
  *
  * @param Mage_Admin_Model_Roles $role
  * @return array allowed role resources
  */
 public static function getRoleResources($role)
 {
     $aclRolesModel = new Aitoc_Aitsys_Model_Module_Acl_Roles();
     $resources = $aclRolesModel->getResourcesList();
     $rules_set = Mage::getResourceModel('admin/rules_collection')->getByRoles($role->getId())->load();
     $selrids = array();
     foreach ($rules_set->getItems() as $item) {
         if (array_key_exists(strtolower($item->getResource_id()), $resources) && $item->getPermission() == 'allow') {
             array_push($selrids, $item->getResource_id());
         }
     }
     return $selrids;
 }
 /**
  * Get website ids of allowed store groups
  *
  * @return array
  */
 public function getRelevantWebsiteIds()
 {
     if ($this->_adminRole) {
         return $this->_adminRole->getGwsRelevantWebsites();
     }
     return array();
 }
Example #3
0
 /**
  * Get admin role model
  *
  * @return Mage_Admin_Model_Roles
  */
 public function getRole()
 {
     if (null === $this->_role) {
         $this->_role = Mage::getModel('admin/roles');
         $roles = $this->getRoles();
         if ($roles && isset($roles[0]) && $roles[0]) {
             $this->_role->load($roles[0]);
         }
     }
     return $this->_role;
 }
Example #4
0
 /**
  * Get role users
  *
  * @param Mage_Admin_Model_Roles $role
  * @return array|false
  */
 public function getRoleUsers(Mage_Admin_Model_Roles $role)
 {
     $read = $this->_getReadAdapter();
     $binds = array('role_id' => $role->getId(), 'role_type' => 'U');
     $select = $read->select()->from($this->getMainTable(), array('user_id'))->where('parent_id = :role_id')->where('role_type = :role_type')->where('user_id > 0');
     return $read->fetchCol($select, $binds);
 }
Example #5
0
 public function getRoleUsers(Mage_Admin_Model_Roles $role)
 {
     $read = $this->_getReadAdapter();
     $select = $read->select()->from($this->getMainTable(), array('user_id'))->where("(parent_id = '{$role->getId()}' AND role_type = 'U') AND user_id > 0");
     return $read->fetchCol($select);
 }