Horde::permissionDeniedError PHP Method

permissionDeniedError() public static method

Process a permission denied error, running a user-defined hook if necessary.
public static permissionDeniedError ( string $app, string $perm, string $error = null )
$app string Application name.
$perm string Permission name.
$error string An error message to output via the notification system.
    public static function permissionDeniedError($app, $perm, $error = null)
    {
        try {
            $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('perms_denied', 'horde', array($app, $perm));
        } catch (Horde_Exception_HookNotSet $e) {
        }
        if (!is_null($error)) {
            $GLOBALS['notification']->push($error, 'horde.warning');
        }
    }

Usage Example

示例#1
0
文件: edit.php 项目: jubinpatel/horde
function _check_max()
{
    $perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
    if ($perms->hasAppPermission('max_events') !== true && $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
        Horde::permissionDeniedError('kronolith', 'max_events', sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')));
        return false;
    }
    return true;
}
All Usage Examples Of Horde::permissionDeniedError