diff --git a/phpgwapi/inc/class.acl.inc.php b/phpgwapi/inc/class.acl.inc.php index 90e083691d..6e2e73efb0 100644 --- a/phpgwapi/inc/class.acl.inc.php +++ b/phpgwapi/inc/class.acl.inc.php @@ -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 -?> +?> \ No newline at end of file