Exemplo n.º 1
0
 public function getResourceAction()
 {
     if ($this->request->isPost()) {
         if ($this->request->isAjax()) {
             $request = $this->request->getPost('resource');
             $resource = AclResources::findFirstByName($request);
             $payload = array('error' => 0);
             if ($resource) {
                 $payload['error'] = 0;
                 $payload['description'] = $resource->description;
                 if ($resource->name != '*') {
                     $resourceAccess = AclResourcesAccess::findByResourcesName($resource->name)->toArray();
                 } else {
                     $resourceAccess = AclResourcesAccess::find()->toArray();
                 }
                 $payload['data'] = $resourceAccess;
             } else {
                 $payload['error'] = 1;
                 $payload['message'] = _('No ACL Resources found');
             }
             return $this->sendAjax($payload);
         }
     }
 }
Exemplo n.º 2
0
 public function isResource($resourceName)
 {
     return AclResources::findFirstByName($resourceName);
     // return is_object($resource);
 }