Ejemplo n.º 1
0
 function FindGroupID($name)
 {
     $group = new Lan_permission_groups();
     $group->group_name = $name;
     $group->find();
     if ($group->fetch()) {
         return $group->permgroup_id;
     }
 }
Ejemplo n.º 2
0
function SetupGroups()
{
    //Get groups
    $groups = array();
    $group = new Lan_permission_groups();
    //Setup system groups
    //Anonymous == everyone
    $groups[] = $group->FindGroupID("Anonymous");
    //Are we logged in?
    if (!streq(getCurrentUID(), "0")) {
        $groups[] = $group->FindGroupID("Registered");
    }
    //Attending this lan?
    $attendee = new lan_attendees();
    $attendee->user_id = getCurrentUID();
    $attendee->lan_id = getCurrentLID();
    if ($attendee->count() != 0) {
        $groups[] = $group->FindGroupID("Attending");
    }
    //Booked a place at this lan?
    $booked = false;
    $sold = new Lan_addons_sold();
    $addon = new Lan_addons_groups();
    $sold->joinAdd($addon);
    $sold->user_id = getCurrentUID();
    $sold->lan_id = getCurrentLID();
    $sold->find();
    while ($sold->fetch()) {
        if (streq($sold->allowSeating, "1")) {
            $groups[] = $group->FindGroupID("Booked");
            break;
        }
    }
    //Integration mode flag group.
    //if(defined("_LANMAN_INTEGRATION"))
    //$groups[] = $group->FindGroupID("Integration");
    //Membership based groups
    if (!streq(getCurrentUID(), "0")) {
        $group = new lan_permission_groups();
        $membership = new lan_permission_membership();
        $group->user_group = 1;
        $membership->user_id = getCurrentUID();
        $group->joinAdd($membership);
        $group->find();
        while ($group->fetch()) {
            $groups[] = $group->permgroup_id;
        }
    }
    $_SESSION['groups'] = $groups;
}
Ejemplo n.º 3
0
    if ($mode->get(escape($_POST["mode"]))) {
        $master->Smarty->assign("mode", $mode);
    } else {
        $master->AddError("Unknown permission group passed!");
    }
} else {
    $mode->find();
    if ($mode->fetch()) {
        $master->Smarty->assign("mode", $mode);
    } else {
        $master->AddError("Could not find any groups to display!");
    }
}
//Find groups
$groups = array();
$group = new Lan_permission_groups();
$group->find();
while ($group->fetch()) {
    $groups[] = clone $group;
}
$master->Smarty->assign("grouplist", $groups);
//Find permissions for each mode and group
$permissionlist = array();
$permission = new Lan_permission();
$permission->orderBy("module");
$permission->find();
while ($permission->fetch()) {
    $disallowedlist = array();
    foreach ($groups as $group) {
        $setting = new Lan_permission_settings();
        $setting->permission_id = $permission->permission_id;