mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 04:11:49 +02:00
new acl function to grab apps enabled for user and groups associated to
This commit is contained in:
parent
f77d5388a2
commit
716b8fe6ee
@ -368,6 +368,44 @@ It should use the values in the $this->data
|
|||||||
return $accounts;
|
return $accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_user_applications($account_id = False)
|
||||||
|
{
|
||||||
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
$db2 = $this->db;
|
||||||
|
|
||||||
|
if ($account_id == False){
|
||||||
|
$account_id = $phpgw_info['user']['account_id'];
|
||||||
|
}
|
||||||
|
$memberships = $phpgw->accounts->memberships($account_id);
|
||||||
|
$sql = "select acl_appname, acl_rights from phpgw_acl where acl_location = 'run' and "
|
||||||
|
. 'acl_account in ';
|
||||||
|
$security = '('.$account_id;
|
||||||
|
while($groups = each($memberships))
|
||||||
|
{
|
||||||
|
$group = each($groups);
|
||||||
|
$security .= ','.$group[1]['account_id'];
|
||||||
|
}
|
||||||
|
$security .= ')';
|
||||||
|
$db2->query($sql . $security ,__LINE__,__FILE__);
|
||||||
|
|
||||||
|
if ($db2->num_rows() == 0){ return False; }
|
||||||
|
while ($db2->next_record())
|
||||||
|
{
|
||||||
|
if(isset($apps[$db2->f('acl_appname')]))
|
||||||
|
{
|
||||||
|
$rights = $apps[$db2->f('acl_appname')];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rights = 0;
|
||||||
|
}
|
||||||
|
$rights |= $db2->f('acl_rights');
|
||||||
|
$apps[$db2->f('acl_appname')] |= $rights;
|
||||||
|
}
|
||||||
|
return $apps;
|
||||||
|
}
|
||||||
|
|
||||||
function get_grants($app=False){
|
function get_grants($app=False){
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
@ -49,9 +49,12 @@
|
|||||||
$this->read_installed_apps();
|
$this->read_installed_apps();
|
||||||
}
|
}
|
||||||
$this->data = Array();
|
$this->data = Array();
|
||||||
|
if($this->account_id == False) { return False; }
|
||||||
|
$apps = $phpgw->acl->get_user_applications($this->account_id);
|
||||||
reset($phpgw_info['apps']);
|
reset($phpgw_info['apps']);
|
||||||
while ($app = each($phpgw_info['apps'])) {
|
while ($app = each($phpgw_info['apps'])) {
|
||||||
$check = $phpgw->acl->check('run',1,$app[0]);
|
// $check = $phpgw->acl->check('run',1,$app[0]);
|
||||||
|
$check = $apps[$app[0]];
|
||||||
if ($check) {
|
if ($check) {
|
||||||
$this->data[$app[0]] = array('title' => $phpgw_info['apps'][$app[0]]['title'], 'name' => $app[0], 'enabled' => True, 'status' => $phpgw_info['apps'][$app[0]]['status']);
|
$this->data[$app[0]] = array('title' => $phpgw_info['apps'][$app[0]]['title'], 'name' => $app[0], 'enabled' => True, 'status' => $phpgw_info['apps'][$app[0]]['status']);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user