function exponent_permissions_grant($user, $permission, $location)
{
    if ($user !== null) {
        if (!exponent_permissions_checkUser($user, $permission, $location)) {
            $obj = null;
            $obj->uid = $user->id;
            $obj->module = $location->mod;
            $obj->source = $location->src;
            $obj->internal = $location->int;
            $obj->permission = $permission;
            global $db;
            $db->insertObject($obj, "userpermission");
        }
    }
}
예제 #2
0
    if (!defined('SYS_USERS')) {
        include_once BASE . 'subsystems/users.php';
    }
    $users = array();
    $modclass = $loc->mod;
    $mod = new $modclass();
    $perms = $mod->permissions($loc->int);
    $have_users = 0;
    foreach (exponent_users_getAllUsers(0) as $u) {
        $have_users = 1;
        foreach ($perms as $perm => $name) {
            $var = 'perms_' . $perm;
            if (exponent_permissions_checkUser($u, $perm, $loc, true)) {
                $u->{$var} = 1;
            } else {
                if (exponent_permissions_checkUser($u, $perm, $loc)) {
                    $u->{$var} = 2;
                } else {
                    $u->{$var} = 0;
                }
            }
        }
        $users[] = $u;
    }
    $template->assign('have_users', $have_users);
    $template->assign('users', $users);
    $template->assign('perms', $perms);
    $template->output();
} else {
    echo SITE_403_HTML;
}