phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] admin-modul enabled for the use?


From: Dave Hall
Subject: Re: [Phpgroupware-developers] admin-modul enabled for the use?
Date: Tue, 01 Jun 2004 21:51:31 +1000

On Tue, 2004-06-01 at 18:30, Matthias Leonhardt wrote:
> Hi,
> 
> what is the simplest way to get the info:
> - is the module admin enabled
> - has the user with $userid access to the module if it is enabled
> 

Simple way:

if(isset($GLOBALS['phpgw_info']['user']['apps']['admin']) 
        && $GLOBALS['phpgw_info']['user']['apps']['admin'])
{
        do some admin only stuff
}

More complex way - where $user_id != $current_user:
<snip />
$apps = createOject('phpgwapi.applications', $user_id);

if( is_system_enabled('admin') )
{
        return false; //admin not installed
}

$user_apps = $apps->read_repository();
if(! (isset($user_apps['admin']) 
        && is_array($user_apps['admin']) ) )
{
        return false; //admin not availble to user
}

//admin only code here
<snip />

> thanks for your help!

np

Cheers

Dave





reply via email to

[Prev in Thread] Current Thread [Next in Thread]