diff --git a/phpgwapi/inc/class.applications.inc.php b/phpgwapi/inc/class.applications.inc.php index e18ff66735..12fd82bfec 100755 --- a/phpgwapi/inc/class.applications.inc.php +++ b/phpgwapi/inc/class.applications.inc.php @@ -76,6 +76,9 @@ $this->account_id = $owner_id; $this->read_user_group_apps($this->account_id); $this->read_user_apps($this->account_id); + if($load_info) { + $phpgw_info["user"]["apps"] = $this->apps_enabled(); + } } } } @@ -121,18 +124,38 @@ global $phpgw, $phpgw_info; $db2 = $phpgw->db; - - if ($this->is_type($lid,"integer")) { - $db2->query("select account_permissions from accounts where account_id=$lid",__LINE__,__FILE__); + + if ($this->is_type($lid,"string")) { + $db2->query("select account_id from accounts where account_lid='$lid'",__LINE__,__FILE__); + if($db2->num_rows()) { + $db2->next_record(); + $account_id = $db2->f("account_id"); + } else { + return False; + } + } elseif ($this->is_type($lid,"integer")) { + $account_id = $lid; } else { - $db2->query("select account_permissions from accounts where account_lid='$lid'",__LINE__,__FILE__); + return False; } + + $db2->query("SELECT * FROM phpgw_acl WHERE acl_location='run' AND acl_account_type='u' AND acl_account=".$account_id,__LINE__,__FILE__); if($db2->num_rows()) { + while($db2->next_record()) { + $apps[] = $db2->f("acl_appname"); + } + } else { + $db2->query("select account_permissions from accounts where account_id=$account_id",__LINE__,__FILE__); $db2->next_record(); - $apps = explode(":",$db2->f("account_permissions")); -if($lid <> $phpgw_info["user"]["account_id"]) echo "\n"; - for ($i=1; $i $phpgw_info["user"]["account_id"]) echo "\n"; + $apps_perms = explode(":",$db2->f("account_permissions")); + for($i=1;$i $phpgw_info["user"]["account_id"]) echo "\n"; + for ($i=0; $i $phpgw_info["user"]["account_id"]) echo "\n"; if ($this->enabled[$apps[$i]] == 1) { $this->user_apps[$apps[$i]] = $apps[$i]; $this->enabled[$apps[$i]] = 2; @@ -146,7 +169,23 @@ if($lid <> $phpgw_info["user"]["account_id"]) echo "