Exemplo n.º 1
0
 public function findallAction()
 {
     $role = new Acl_Model_Role();
     $roles = $role->findAll();
     $default_role = $role->findDefaultRoleId();
     $data = array();
     foreach ($roles as $role) {
         $is_default_role = false;
         if ($role->getId() == $default_role) {
             $is_default_role = true;
         }
         $data[] = array("id" => $role->getId(), "code" => $role->getCode(), "label" => $role->getLabel(), "default" => $is_default_role);
     }
     $this->_sendHtml($data);
 }
Exemplo n.º 2
0
 public function findAction()
 {
     $resources_data = array();
     if ($this->getRequest()->getParam("role_id")) {
         $role = new Acl_Model_Role();
         $role->find($this->getRequest()->getParam("role_id"));
         $resource = new Acl_Model_Resource();
         $role_resources = $resource->findResourcesByRole($this->getRequest()->getParam("role_id"));
         foreach ($role_resources as $role_resource) {
             $resources_data[] = $role_resource;
         }
         $data_title = $this->_("Edit %s role", $role->getCode());
         $role = array("id" => $role->getId(), "code" => $role->getCode(), "label" => $role->getLabel(), "default" => $role->isDefaultRole());
     } else {
         $data_title = $this->_("Create a new role");
         $role = array("code" => "", "label" => "");
     }
     $data = array("title" => $data_title, "role" => $role);
     $resource = new Acl_Model_Resource();
     $data["resources"] = $resource->getHierarchicalResources($resources_data);
     $this->_sendHtml($data);
 }