/** * Overrides a permission for a user. You can use this to further customise * a Package for a specific user, for instance, allowing a regular user to blog * or revoking someone's commenting rights, all without setting up a new package. * * @param UserRepresentation $user User ID to change * @param string $permission Permission name to change * @param bool $new_value New permission. true = yes, false = no. * @return $this * @uses StorageDelegate * @throws Exception\User * @throws Exception\Override */ public function overridePermissionForUser(UserRepresentation $user, $permission, $new_value) { // Check that there is actually a permission called $permission: if (!array_key_exists($permission, $this->permissions_cache[$user->id()])) { throw new Exception\Override('Unknown permission: ' . $permission . ' on user id: ' . $user->id(), Exception\Override::UNKNOWN_PERMISSION); } if ($this->storage->authOverridePermissionForUser($this->name(), $user, $permission, $new_value)) { $this->buildPermissionsForUser($user); } return $this; }
public function authResetOverridesForUser($instance_name, UserRepresentation $user) { if (array_key_exists($user->id(), $this->users)) { $this->users[$user->id()]['overrides'] = array(); } return true; }