forked from extern/egroupware
trying to get code ready for admin pages
This commit is contained in:
parent
80722d6260
commit
52796590bf
@ -174,23 +174,33 @@
|
||||
return $group_names;
|
||||
}
|
||||
|
||||
function listusers($groups="")
|
||||
function listusers($group="")
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
$db = $phpgw->db;
|
||||
$db2 = $phpgw->db;
|
||||
|
||||
if ($groups) {
|
||||
$db->query("select account_lid,account_firstname,account_lastname from accounts where account_groups"
|
||||
. "like '%,$groups,%'",__LINE__,__FILE__);
|
||||
if ($group) {
|
||||
$users = $phpgw->acl->get_ids_for_location($group, 1, "phpgw_group", "u");
|
||||
reset ($users);
|
||||
$sql = "select account_lid,account_firstname,account_lastname from accounts where account_id in (";
|
||||
for ($idx=0; $idx<count($num); ++$idx){
|
||||
if ($idx == 1){
|
||||
$sql .= $users[$idx];
|
||||
}else{
|
||||
$sql .= ",".$users[$idx];
|
||||
}
|
||||
}
|
||||
$sql .= ")";
|
||||
$db2->query($sql,__LINE__,__FILE__);
|
||||
} else {
|
||||
$db->query("select account_lid,account_firstname,account_lastname from accounts",__LINE__,__FILE__);
|
||||
$db2->query("select account_lid,account_firstname,account_lastname from accounts",__LINE__,__FILE__);
|
||||
}
|
||||
$i = 0;
|
||||
while ($db->next_record()) {
|
||||
$accounts["account_lid"][$i] = $db->f("account_lid");
|
||||
$accounts["account_firstname"][$i] = $db->f("account_firstname");
|
||||
$accounts["account_lastname"][$i] = $db->f("account_lastname");
|
||||
while ($db2->next_record()) {
|
||||
$accounts["account_lid"][$i] = $db2->f("account_lid");
|
||||
$accounts["account_firstname"][$i] = $db2->f("account_firstname");
|
||||
$accounts["account_lastname"][$i] = $db2->f("account_lastname");
|
||||
$i++;
|
||||
}
|
||||
return $accounts;
|
||||
|
@ -131,15 +131,25 @@
|
||||
return $group_names;
|
||||
}
|
||||
|
||||
function listusers($groups="")
|
||||
function listusers($group="")
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
$db2 = $phpgw->db;
|
||||
|
||||
if ($groups) {
|
||||
$db2->query("select account_lid,account_firstname,account_lastname from accounts where account_groups"
|
||||
. "like '%,$groups,%'",__LINE__,__FILE__);
|
||||
if ($group) {
|
||||
$users = $phpgw->acl->get_ids_for_location($group, 1, "phpgw_group", "u");
|
||||
reset ($users);
|
||||
$sql = "select account_lid,account_firstname,account_lastname from accounts where account_id in (";
|
||||
for ($idx=0; $idx<count($num); ++$idx){
|
||||
if ($idx == 1){
|
||||
$sql .= $users[$idx];
|
||||
}else{
|
||||
$sql .= ",".$users[$idx];
|
||||
}
|
||||
}
|
||||
$sql .= ")";
|
||||
$db2->query($sql,__LINE__,__FILE__);
|
||||
} else {
|
||||
$db2->query("select account_lid,account_firstname,account_lastname from accounts",__LINE__,__FILE__);
|
||||
}
|
||||
|
@ -206,5 +206,26 @@
|
||||
return $locations;
|
||||
}
|
||||
|
||||
function get_ids_for_location($location, $required, $app = False, $id_type = "u"){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($app == False){
|
||||
$app = $phpgw_info["flags"]["currentapp"];
|
||||
}
|
||||
$sql = "select acl_account from phpgw_acl where acl_appname = '$app' and ";
|
||||
$sql .= "acl_account_type = '".$id_type."' and acl_location = ".$location;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
if ($this->db->num_rows() == 0 ){ return False; }
|
||||
while ($this->db->next_record()) {
|
||||
if ($this->db->f("acl_rights") == 0){ return False; }
|
||||
$rights |= $this->db->f("acl_rights");
|
||||
if (!!($rights & $required) == True){
|
||||
$accounts[] = $this->db->f("acl_account");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
} //end of acl class
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user