/** * TODO * * @param mixed $object * @param IPermission $permission * @param LoginContext $context * @return bool TRUE if the handler performed the permission check successfully, FALSE otherwise. * * @throws EyeInvalidArgumentException * @throws EyeUnexpectedValueException * @throws EyeAccessControlException */ public function checkPermission($object, IPermission $permission, LoginContext $context) { try { $eyeosUser = $context->getEyeosUser(); } catch (EyeNullPointerException $e) { $this->failureException = new EyeHandlerFailureException('No eyeos user found in login context.'); return false; } if ($object->getId() == $eyeosUser->getId()) { $refPermissions = new SimplePermission('', array('update', 'delete')); if ($refPermissions->implies($permission)) { return true; } } throw new EyeAccessControlException('Access denied to UM (actions: ' . $permission->getActionsAsString() . ')'); }
/** * @param string $name * @param mixed $actions Array of string containing the actions for this permission. */ public function __construct($name = '', $actions = '') { parent::__construct($name, $actions, null); }
public function __construct($actions, $originalMetaData = null, $relatedObject = null) { if ($originalMetaData !== null && !$originalMetaData instanceof IMetaData) { throw new EyeInvalidClassException('$originalMetaData must be an instance of IMetaData.'); } parent::__construct('', $actions, $relatedObject); $this->originalMetaData = $originalMetaData; }