/** * add a parent Role * * @param App_Acl_Role $role * @return App_Acl_Role $this */ public function addParentRole(App_Acl_Role $role) { $this->parentRoles[$role->getRoleId()] = $role; return $this; }
/** * load the roles into the ACL * * @param array $roles * @return array with loaded App_Acl_Role * @todo check if storing the Zend_Acl_Roles in an extra class array is needed */ private function loadRoles($roles) { foreach ($roles as $key => $val) { $roleSet = $this->aclDbModel->getParentRoles($key); $parent = NULL; $role = new App_Acl_Role($key, $val); $this->roles[$key] = $role; // @todo: needed? $roles[$key] = $role; if (count($roleSet) > 0) { foreach ($roleSet as $row) { $parent = new App_Acl_Role($row['uar_id'], $row['uar_name']); $role->addParentRole($parent); if ($this->hasRole($parent) === FALSE) { $this->addRole($parent); } $this->roles[$row['uar_id']] = $parent; // @todo: needed? $roles[$row['uar_id']] = $parent; } } if ($this->hasRole($role) === FALSE) { $this->addRole($role, $parent); } } return (array) $roles; }