if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    $users = array();
    $modclass = $loc->mod;
    $mod = new $modclass();
    $perms = $mod->permissions($loc->int);
    $have_users = 0;
    foreach (pathos_users_getAllUsers(0) as $u) {
        $have_users = 1;
        foreach ($perms as $perm => $name) {
            $var = "perms_{$perm}";
            if (pathos_permissions_checkUser($u, $perm, $loc, true)) {
                $u->{$var} = 1;
            } else {
                if (pathos_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;
示例#2
0
function pathos_permissions_grant($user, $permission, $location)
{
    if ($user !== null) {
        if (!pathos_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");
        }
    }
}