[development] Perms vs Settings
Jerad Bitner
sirkitree at gmail.com
Sat Dec 6 19:01:06 UTC 2008
It sounds like you need to use hook_perm() here. Though you can always
implement your settings per role within your module's settings page as well
by pulling in the roles.
The question is how do you want to define the setting relationships to
roles? settings->roles or roles->settings ?
The first you would pull in the roles to your settings page, save the role
id with the setting and then provide your own function to check that
setting's role designator.
The second way you just provide a permission to hook_perm() and then you can
check with user_access().
You also need to determine how you need to use these permissions... Is it a
general permission, such as 'administer this module' or is it a setting that
is per an object. For instance Views and Flag provide access to each
individual object (a view or a flag) so that a particular role can access an
individual object but also provide a permission in the other sense, such as
'can administer this object'.
Hope that helps.
On Sat, Dec 6, 2008 at 6:41 AM, DragonWize <dragonwize at gmail.com> wrote:
> Hi Deji,
>
> I know hook_perm. My question is what does and does not belong in
> hook_perm?
>
> Thank you,
> Alan
>
>
> On Fri, Dec 5, 2008 at 18:32, Deji Akala <dejiakala at gmail.com> wrote:
> > Hi dragonwize,
> >
> > Have you tried hook_perm() ?
> >
> > 2008/12/5 DragonWize <dragonwize at gmail.com>
> >>
> >> Hi,
> >>
> >> I have a module that I has some display settings and I would like to
> >> make these settings per role. The easy way it seems to be to use the
> >> core perm system, however, I am not entirely sure that they really
> >> belong there.
> >>
> >> Is there and consensus or thoughts on what should be a perm vs a module
> >> setting.
> >>
> >> Thanks,
> >> Alan
> >
> >
> >
> > --
> > Deji Akala
> > iJed Webs Ltd
> > http://www.ijed.co.uk
> > Tel: +44 (0)1793 495537
> > Mob: +44 (0)7951 619654
> >
> > "He is no fool who gives what he cannot keep to gain what he cannot
> lose."
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20081206/575543b7/attachment.htm
More information about the development
mailing list