[horde] Conf or pref?
Chuck Hagenbuch
chuck at horde.org
Sun Feb 15 03:26:48 UTC 2009
Quoting Chris Hastie <lists at oak-wood.co.uk>:
> When should a setting be set as a configuration parameter and when as a
> preference?
>
> My particular query relates to the asterisk dialler I'm looking at,
> probably to be called Astral. One setting that needs to be taken care of
> is the context within the Asterisk dialplan that a call is begun. The
> context dictates, amongst other things, what numbers can be called. As
> such it seemed to me to be a system admin, not a user decision, so I
> originally dealt with it as a config parameter.
>
> It now occurs to me that this probably makes it global to all users, and
> that in some situations you may, for example, want some users to place
> calls in a context that can only dial national calls, whilst others are
> placed in a context that can dial international calls. The obvious way
> to allow this seems to be to move the setting to prefs, where it could
> potentially be set with a hook.
>
> But this makes setting the module up more complex. It will almost
> certainly require editing prefs.php to set the context, as dialplans are
> highly variable. The preference would almost always be locked (it's
> difficult to imagine why you would want users to be able to set it).
>
> Or can a config value be changed dynamically depending on the user?
> Manipulating $conf from _horde_hook_postauthenticate perhaps? If so, is
> this a sensible move?
What about making the context an object that's managed by the
application (in a database or other backend), and using Horde_Perms to
control who can see what context? I don't know how complicated a
context is and how flexible you want to go, but that's one option.
Otherwise, leaving it in the config file seems fine for now - that way
it can be changed by hooks or just by putting PHP code at the end of
the conf file.
-chuck
More information about the horde
mailing list