Re: Specific configuration based on the group of the user

Lukas Weiss <[email protected]>
Newsgroups gmane.comp.horde.devel
Message-ID <[email protected]>
Am 25.09.2014 11:33, schrieb Jan Schneider:
>
> Zitat von Alex Lanz <[email protected]>:
>
>> Hi,
>>
>> I have a problem with the configurations. I want to allow sharing only
>> for a specific group of users. In the conf.php file the value for
>> sharing can be set with the following line:
>>
>> $conf['share']['no_sharing'] = true;
>>
>> Although I want to allow sharing for advanced user that are in the
>> group "advanced". My first try was add the following lines to the
>> conf.local.php file:
>>
>> $conf['share']['no_sharing'] = (isAdvancedUser() ? false : true);
>>
>> The function "isAdvancedUser" contains these lines:
>>
>> function isAdvancedUser() {
>>   global $registry, $injector;
>>   $groups = $injector->getInstance('Horde_Group');
>>   $myGroups = $groups->listAll($registry->getAuth());
>>   return in_array('advanced', $myGroups);
>> }
>>
>> The problem is that the session is not started when the configuration
>> files are read. Is there a point in the code where I can modify this
>> value based on the user's group?
>>
>> Thanks
>> Alex
>
> The postauthenticate hook might be a good place. Make sure you use the
> global $session object to change the cached configuration values.
>

Thanks for your reply.

Isn't the conf.local.php read on every page reload?

I couldn't figure out how to change the configuration cache with the 
$session object. could you please give me a hint? thank you!

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.