Im working on user permissions, and i have 2 tables (“User-Role-Groups” & “User-Roles”).
What i need is to check if “priority” in one of “User-Role-Groups” is larger than the priority given but to do that i need to check the User-Role-Groups against User-Roles, aka if the user is in any group thats priority is higher that the one i’m checking it against. So User-Roles basically has 2 fields (user_id & role_id), and User-Role-Groups has 1 field in common with User-Roles (role_id). And priority comes from User-Role-Groups
Hi @ragnarvidevik, I have a lot of experience with user roles and permissions so I may be able to help. Please see this response I wrote to a different question on a similar topic:
What I would do is use the methods I described here and the conditional that will be checked is going to be something along the lines of run workflow only when user’s group’s priority > other group’s priority. Please let me know if that makes sense, I may be misunderstanding your permission’s system a little.
One piece of advice I have is that it may make sense to simplify your permissions system a little. If you are running complex searches in conditionals just t determine whether or not a workflow should be run, it could negatively impact your performance considerably.
Well basically i want users to be able to have multiple groups for example (Member, Donator Level I, Server Moderator) and at the same time every group to have diffrent permissions.
Priority problem became from my roles page aka if user is able to edit a role. If any of user roles priority is higher than the priority of a given role he wants to edit, then he can edit it, if not then he cannot.
I could make role types aka (donator_role, admin_role, misc_role) under table “User”
And then be able for the user to have 1 role of each type. Then i can actually do a search: ‘Search for User-Role-Groups (id = Current User’s admin_role/donator_role/misc_role)'s priority’ .But instead for my learning purposes and also to avoid making those diffrent types i thought maybe there is a way to actually search for User-Role-Group’s priority using list of User-Roles and Current User ID.
From what i undrestood from your post was exactly the “type” way of doing it. But maybe there is a more difficult way to do the search and avoid creating those “types”