mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:36 +01:00
fixed get_app_list_for_id and get_location_list_for_id so that they return on the entries for the specified user or group. As would be expected.
This commit is contained in:
parent
0cc6d28d3c
commit
9b8a1cd8f7
@ -102,55 +102,12 @@
|
||||
return True;
|
||||
}
|
||||
|
||||
function get_app_list($location, $required){
|
||||
global $phpgw, $phpgw_info;
|
||||
// User piece
|
||||
$sql = "select acl_appname, acl_rights from phpgw_acl where (acl_location in ('$location','everywhere')) ";
|
||||
$sql .= " and ((acl_account_type = 'u' and acl_account = '".$phpgw_info["user"]["account_id"]."')";
|
||||
|
||||
// Group piece
|
||||
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
||||
$memberships = $phpgw->accounts->read_group_names();
|
||||
if (is_array($memberships) && count($memberships) > 0){
|
||||
for ($idx = 0; $idx < count($memberships); ++$idx){
|
||||
$sql .= ",".$memberships[$idx][0];
|
||||
}
|
||||
}
|
||||
$sql .= ")))";
|
||||
|
||||
$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){
|
||||
$apps[] = $this->db->f("acl_appname");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
return $apps;
|
||||
}
|
||||
|
||||
function get_app_list_for_id($location, $required, $id_type = "", $id = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($id == ""){ $id = $phpgw_info["user"]["account_id"]; }
|
||||
if ($id_type == ""){ $id_type = "u"; }
|
||||
$sql = "select acl_appname, acl_rights from phpgw_acl where acl_location = '$location' and ";
|
||||
if ($id_type == "u"){
|
||||
$sql .= "acl_account_type = 'u' and acl_account = ".$id;
|
||||
}elseif($id_type == "g"){
|
||||
$sql .= "acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
||||
// Group piece
|
||||
if (is_array($memberships) && count($memberships) > 0){
|
||||
for ($idx = 0; $idx < count($memberships); ++$idx){
|
||||
$sql .= ",".$memberships[$idx][0];
|
||||
}
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
$sql .= "acl_account_type = '".$id_type."' and acl_account = ".$id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
if ($this->db->num_rows() == 0 ){ return False; }
|
||||
@ -202,19 +159,7 @@
|
||||
if ($id == ""){ $id = $phpgw_info["user"]["account_id"]; }
|
||||
if ($id_type == ""){ $id_type = "u"; }
|
||||
$sql = "select acl_location, acl_rights from phpgw_acl where acl_appname = '$app' and ";
|
||||
if ($id_type == "u"){
|
||||
$sql .= "acl_account_type = 'u' and acl_account = ".$id;
|
||||
}elseif($id_type == "g"){
|
||||
$sql .= "acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
||||
// Group piece
|
||||
if (is_array($memberships) && count($memberships) > 0){
|
||||
for ($idx = 0; $idx < count($memberships); ++$idx){
|
||||
$sql .= ",".$memberships[$idx][0];
|
||||
}
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
$sql .= "acl_account_type = '".$id_type."' and acl_account = ".$id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
if ($this->db->num_rows() == 0 ){ return False; }
|
||||
@ -231,4 +176,4 @@
|
||||
}
|
||||
|
||||
} //end of acl class
|
||||
?>
|
||||
?>
|
Loading…
Reference in New Issue
Block a user