/** * Init acl * * @param integer $userRole */ protected function initAcl($userRole) { // init user identity $userIdentity = []; $userIdentity['role'] = $userRole; $userIdentity['user_id'] = $this->userId; UserIdentityService::setCurrentUserIdentity($userIdentity); // init new AclZend $acl = new AclZend(); $acl->addRole(new Role($userRole)); AclService::setCurrentAcl($acl); // get acl resources if (null != ($resources = $this->aclModelBase->getAclResources($userIdentity['role'], $userIdentity['user_id']))) { // process acl resources $resourcesInfo = []; foreach ($resources as $resource) { // add new resource $acl->addResource(new Resource($resource['resource'])); // add resource's action $resource['permission'] == AclModelBase::ACTION_ALLOWED ? $acl->allow($userIdentity['role'], $resource['resource']) : $acl->deny($userIdentity['role'], $resource['resource']); $resourcesInfo[$resource['resource']] = $resource; } AclService::setCurrentAclResources($resourcesInfo); } }