} else { if (pathos_permissions_checkGroup($g, $perm, $loc)) { $g->{$var} = 2; } else { $g->{$var} = 0; } } } $users[] = $g; foreach (pathos_users_getAllGroups() as $g) { foreach ($perms as $perm => $name) { $var = "perms_{$perm}"; if (pathos_permissions_checkGroup($g, $perm, $loc, true)) { $g->{$var} = 1; } else { if (pathos_permissions_checkGroup($g, $perm, $loc)) { $g->{$var} = 2; } else { $g->{$var} = 0; } } } $users[] = $g; } $template->assign("have_users", 1); // users = groups $template->assign("users", $users); // users = groups $template->assign("perms", $perms); ///////////////////////////// $template->output();
function pathos_permissions_grantGroup($group, $permission, $location) { if ($group !== null) { if (!pathos_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->insertObject($obj, "grouppermission"); } } }