General > Developers Corner
Allows with Inheritance
iViscosity:
The issue with that is I'm not trying to get permissions from a player, I'm trying to get it from the group in general.
JamminR:
Oh, From the group, sorry, missed that detail.
Fine, make life more difficult. :P
Might check out the looping in server/ucl.lua for pointers.
Perhaps more specifically, https://github.com/TeamUlysses/ulib/blob/master/lua/ulib/server/ucl.lua#L368
I _think_ we check to ensure a (specific, not inherited) group doesn't already have access before we add access to a group.
You could then use your tree idea to loop through each group.
Or, we just don't care and duplicate it anyway, then call hooks to let every user know they now have access.
It's late, I'm getting tired - I didn't look that close.
iViscosity:
Too late for me too. I'll take a look tomorrow. Thanks
Sent using Tapatalk. Owner of iViscosity Gaming.
Stickly Man!:
Unfortunately, groupAllow does not check up the inheritance chain, as it is possible to give multiple levels access to the same command (with different restrictions, or even with a deny somewhere between the two groups).
I'm not sure if this is the most optimized approach (given that XGUI was a separate entity from ULX when I originally wrote all of this), but here's how XGUI does it:
XGUI starts with a list of access tags that is populated from the server, and sent down to admins who have access to the groups tab.
https://github.com/TeamUlysses/ulx/blob/master/lua/ulx/xgui/server/sv_groups.lua#L290-L300
Then, once a group is selected on the groups tab clientside, I iterate through each access to determine whether or not it has direct access, or inherited access (since I make a distinction in the UI for both cases). The helper methods I created to check that are here:
https://github.com/TeamUlysses/ulx/blob/master/lua/ulx/xgui/groups.lua#L586-L608
.. But basically, for you to use this method, you would need to loop through each access you care about, then make a recursive function that checks a given group for access, and if it doesn't have access, then run the function again with the groups' inherited group, until there isn't one. (Note: this method does not factor in denies at all)
iViscosity:
Interesting. I can filter out permissions that are denied, but that would be helpful. I was having issues using getInheritanceTree() because each value contains a table all the way until the end. I kept trying to go from bottom (user) up (superadmin) but that would make it a lot easier. I plan to store all of these permissions in a text file anyways, so getting them again won't be too hard, unless they're updated.
Thanks for that.
Navigation
[0] Message Index
[*] Previous page
Go to full version