django-sitetree icon indicating copy to clipboard operation
django-sitetree copied to clipboard

Group permisions

Open SoulRaven opened this issue 9 years ago • 7 comments

Are any plans to set also the group permissions for a menu item? is more easy and reliable to make a menu item visible or not depending of the group

SoulRaven avatar Feb 07 '16 21:02 SoulRaven

No plans for now, as access to a single item usually associated with one permission, but not a set described by a group. Meanwhile this kind of check could be achieved using item hook functionality.

idlesign avatar Feb 08 '16 13:02 idlesign

with the hook functionality how i make a menu to been hidden on demand?

SoulRaven avatar Feb 18 '16 09:02 SoulRaven

You define your tree item model with group ManyToManyField field. In your item hook just check every item group against current user group.

idlesign avatar Feb 18 '16 12:02 idlesign

ok, but check against what? is no attribute like item.hidden to set the menu to hidden like item.hidden = True

SoulRaven avatar Feb 18 '16 12:02 SoulRaven

ok, but check against what?

You need to define a custom item model. In it you're free to add any fields you like. E.g. you could have user_group ManyToManyField and check against it item.access_group == user.group

idlesign avatar Feb 18 '16 13:02 idlesign

How do i define a costume menu item, in docs are not any examples for that

will be more easily if in the api exist a method or a flag that define is a specific menu item will be rended or not

SoulRaven avatar Feb 19 '16 06:02 SoulRaven

There's a lot of APIs for that already. See http://django-sitetree.readthedocs.org/en/latest/models.html#models-customization

idlesign avatar Feb 19 '16 12:02 idlesign