/** * Short description of method remove * * @access public * @author Jehan Bihin, <*****@*****.**> * @param string roleUri * @param string accessUri * @return mixed */ public function remove($roleUri, $accessUri) { $uri = explode('#', $accessUri); list($type, $ext, $mod, $act) = explode('_', $uri[1]); $role = new core_kernel_classes_Class($roleUri); $actionAccessProperty = new core_kernel_classes_Property(funcAcl_models_classes_AccessService::PROPERTY_ACL_GRANTACCESS); $module = new core_kernel_classes_Resource($this->makeEMAUri($ext, $mod)); $controllerClassName = funcAcl_helpers_Map::getControllerFromUri($module->getUri()); // access via controller? $controllerAccess = funcAcl_helpers_Cache::getControllerAccess($controllerClassName); if (in_array($roleUri, $controllerAccess['module'])) { // remove access to controller funcAcl_models_classes_ModuleAccessService::singleton()->remove($roleUri, $module->getUri()); // add access to all other actions foreach (funcAcl_helpers_Model::getActions($module) as $action) { if ($action->getUri() != $accessUri) { $this->add($roleUri, $action->getUri()); $this->getEventManager()->trigger(new AccessRightAddedEvent($roleUri, $action->getUri())); } } } elseif (isset($controllerAccess['actions'][$act]) && in_array($roleUri, $controllerAccess['actions'][$act])) { // remove action only $role->removePropertyValues($actionAccessProperty, array('pattern' => $accessUri)); $this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $accessUri)); funcAcl_helpers_Cache::flushControllerAccess($controllerClassName); } }
/** * Short description of method remove * * @access public * @author Jehan Bihin, <*****@*****.**> * @param string $roleUri * @param string $accessUri * @return mixed */ public function remove($roleUri, $accessUri) { $module = new core_kernel_classes_Resource($accessUri); $role = new core_kernel_classes_Class($roleUri); $accessProperty = new core_kernel_classes_Property(funcAcl_models_classes_AccessService::PROPERTY_ACL_GRANTACCESS); // Retrieve the module ID. $uri = explode('#', $module->getUri()); list($type, $extId, $modId) = explode('_', $uri[1]); // access via extension? $extAccess = funcAcl_helpers_Cache::getExtensionAccess($extId); if (in_array($roleUri, $extAccess)) { // remove access to extension $extUri = $this->makeEMAUri($extId); funcAcl_models_classes_ExtensionAccessService::singleton()->remove($roleUri, $extUri); // add access to all other controllers foreach (funcAcl_helpers_Model::getModules($extId) as $eModule) { if (!$module->equals($eModule)) { $this->add($roleUri, $eModule->getUri()); $this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $eModule->getUri())); //$role->setPropertyValue($accessProperty, $eModule->getUri()); } } //funcAcl_helpers_Cache::flushExtensionAccess($extId); } // Remove the access to the module for this role. $role->removePropertyValue($accessProperty, $module->getUri()); $this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $accessUri)); funcAcl_helpers_Cache::cacheModule($module); // Remove the access to the actions corresponding to the module for this role. foreach (funcAcl_helpers_Model::getActions($module) as $actionResource) { funcAcl_models_classes_ActionAccessService::singleton()->remove($role->getUri(), $actionResource->getUri()); } funcAcl_helpers_Cache::cacheModule($module); }