function exponent_permissions_grantGroup($group, $permission, $location)
{
    if ($group !== null) {
        if (!exponent_permissions_checkGroup($group, $permission, $location)) {
            $obj = null;
            $obj->gid = $group->id;
            $obj->module = $location->mod;
            $obj->source = $location->src;
            $obj->internal = $location->int;
            $obj->permission = $permission;
            global $db;
            $db->delete("grouppermission", " gid='" . $obj->gid . "' module = '" . $obj->module . "' AND source='" . $obj->source . "' AND internal='" . $obj->internal . "'");
            $db->insertObject($obj, "grouppermission");
            echo "In groupGrant</br>";
        }
    }
}
Ejemplo n.º 2
0
    //$g->code = "";
    foreach ($perms as $perm=>$name) {
    	$var = "perms_$perm";
    	if (exponent_permissions_checkGroup($g,$perm,$loc,true)) $g->$var = 1;
    	else if (exponent_permissions_checkGroup($g,$perm,$loc)) $g->$var = 2;
    	else $g->$var = 0;
    }
    $users[] = $g;
    */
    foreach (exponent_users_getAllGroups() as $g) {
        foreach ($perms as $perm => $name) {
            $var = 'perms_' . $perm;
            if (exponent_permissions_checkGroup($g, $perm, $loc, true)) {
                $g->{$var} = 1;
            } else {
                if (exponent_permissions_checkGroup($g, $perm, $loc)) {
                    $g->{$var} = 2;
                } else {
                    $g->{$var} = 0;
                }
            }
        }
        $users[] = $g;
    }
    $template->assign('have_users', count($users) > 0);
    // users = groups
    $template->assign('users', $users);
    // users = groups
    $template->assign('perms', $perms);
    $template->output();
} else {