/** * Grant permission for a given ARO to a given ACO. * * @return void */ public function grant() { extract($this->_getParams()); if ($this->Acl->allow($aro, $aco, $action)) { $this->out(__d('cake_console', 'Permission <success>granted</success>.'), true); } else { $this->out(__d('cake_console', 'Permission was <error>not granted</error>.'), true); } }
/** * Grant permission for a given ARO to a given ACO. * * @access public */ function grant() { $this->_checkArgs(3, 'grant'); extract($this->__getParams()); if ($this->Acl->allow($aro, $aco, $action)) { $this->out(__("Permission granted.", true), true); } else { $this->out(__("Permission was not granted.", true), true); } }
function saveAcl($data) { if (empty($data['Group']['permission'])) { return; } App::import('Component', 'Acl'); $acl = new AclComponent(); foreach ($data['Group']['permission'] as $val) { $acl->allow($data['Group']['name'], $val); } return; }
/** * Sync the ARO table * * @return void **/ public function permissions_reset($params = array()) { // @codingStandardsIgnoreEnd $this->Aro->query('TRUNCATE aros_acos;'); $configFile = APP . 'Config' . DS . 'Permissions' . DS . 'permissions.ini'; $ini_array = parse_ini_file($configFile, true); foreach ($ini_array as $group => $permissions) { $denyList = isset($permissions['deny']) ? $permissions['deny'] : array(); $allowList = isset($permissions['allow']) ? $permissions['allow'] : array(); $groupId = $this->_getGroupId($group); $this->Group = ClassRegistry::init('Group'); $group = $this->Group; $group->id = $groupId; foreach ($denyList as $action) { $this->Acl->deny($group, $action); } foreach ($allowList as $action) { $this->Acl->allow($group, $action); } unset($this->Group); } $this->out(__('<success>Permissions Reset Complete</success>')); return true; }
/** * Pass-thru function for ACL allow instance. Allow methods * are used to grant an ARO access to an ACO. * * @param string $aro ARO The requesting object identifier. * @param string $aco ACO The controlled object identifier. * @param string $action Action (defaults to *) * @return boolean Success * @access public */ function allow($aro, $aco, $action = "*") { $this->flushCache(); return parent::allow($aro, $aco, $action); }
/** * Allow method. * * This method overrides and uses the original * method. It only adds cache to it. * * @param string $aro ARO * @param string $aco ACO * @param string $action Action (defaults to *) * @access public */ function allow($aro, $aco, $action = "*") { parent::allow($aro, $aco, $action); $this->__deleteCache($aro, $aco, $action); }