hasPermission() 공개 정적인 메소드

Also checks to see if the user is a Vilma superadmin. If the user is a Horde admin they automatically have permission.
public static hasPermission ( string $domain = null, integer $permmask = null ) : boolean
$domain string Domain for which to check permissions.
$permmask integer Permissions that must be set for the user.
리턴 boolean True if the user has the requested permission.
예제 #1
0
파일: index.php 프로젝트: jubinpatel/horde
<?php

/**
 * Copyright 2003-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you did not
 * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
 *
 * @author Marko Djukic <*****@*****.**>
 */
require_once __DIR__ . '/../lib/Application.php';
$vilma = Horde_Registry::appInit('vilma');
/* Only admin should be using this. */
if (!Vilma::hasPermission()) {
    throw new Horde_Exception_AuthenticationFailure();
}
// Having a current domain doesn't make sense on this page
Vilma::setCurDomain();
try {
    $domains = $vilma->driver->getDomains();
} catch (Exception $e) {
    $notification->push($e, 'horde.error');
    $domains = array();
}
$editurl = Horde::url('domains/edit.php');
$deleteurl = Horde::url('domains/delete.php');
$userurl = Horde::url('users/index.php');
foreach ($domains as &$domain) {
    $domain['edit_url'] = $editurl->copy()->add('domain_id', $domain['domain_id']);
    $domain['del_url'] = $deleteurl->copy()->add('domain_id', $domain['domain_id']);
    $domain['view_url'] = $userurl->copy()->add('domain_id', $domain['domain_id']);
예제 #2
0
<?php

/**
 * The Vilma script to add/edit aliases.
 *
 * Copyright 2003-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you did
 * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
 *
 * @author Daniel Collins <*****@*****.**>
 */
require_once __DIR__ . '/../lib/Application.php';
$vilma = Horde_Registry::appInit('vilma');
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
    throw new Horde_Exception_AuthenticationFailure();
}
$vars = Variables::getDefaultVariables();
/* If the form is submitted, $vars['mode'] will be set. Catch this and process
 * the submission so that the displayed form accurately indicates the result of
 * the transaction. */
if (isset($vars->mode)) {
    $form = new Vilma_Form_EditAlias($vars);
    if ($form->validate($vars)) {
        $form->getInfo($vars, $info);
        try {
            $alias_id = $vilma->driver->saveAlias($info);
            $notification->push(_("Alias saved."), 'horde.success');
            Horde::url('users/index.php', true)->add('domain_id', $domain['id'])->redirect();
        } catch (Exception $e) {