Having a user belong to 2 groups with different priviledges

21 views
Skip to first unread message

mostwanted

unread,
Jun 18, 2020, 2:12:44 AM6/18/20
to web2py-users
Is it possible to have users belong to 2 groups and in those groups have them perform different tasks?
I am trying to divide users by their regions so that they can only see content uploaded by their regions and also in their regions have them belong to groups with different privileges.

E.G: In region 1 I want to have HR and Admin doing different tasks, also have region 2 with also its HR and Admin groups having different privileges. Is this possible?

So far I have only been able to divide users into regions and have them view only contents uploaded by their groups.

Regards;

Mostwanted

Annet

unread,
Jun 18, 2020, 5:50:39 AM6/18/20
to web2py-users
I am not sure I completely understand what you want, but what about groups
Region 1, Region 2, HR and Admin.

User 1 has membership Region1 and HR
User 2 has membership Region2 and HR

In your code you could have

if auth.has_membesrhip(Region1) and auth.has_membesrhip(HR)
   tasks ...
elif auth.has_membesrhip(Region2) and auth.has_membesrhip(HR)
   task ...

Maybe this points you in the direction of a solution



Best,

Annet
Reply all
Reply to author
Forward
0 new messages