• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Get minimum value from integer permission

katsulynx

Well-known member
#1
I've noticed that calling hasPermission() on integer permissions always returns the maximum value (except for -1). Is there a way to find the minimum value of all groups the user has that have this value set (not 0)?
 

Mike

XenForo developer
Staff member
#2
The only approach would involve querying all of the relevant permissions manually. If you can approach what you're trying to do differently, that would probably be the ideal approach; permissions should generally be "positive" (so yes/bigger is more permissive), though I appreciate that's difficult in some scenarios.
 

Jake B.

Well-known member
#3
Would an option when creating the permission definition for this be reasonable? I could definitely see this being useful for some things such as Instead of completely disabling/enabling flood check times for a usergroups, make it so certain user groups can post every 10 seconds while regular users can only post every 30, for example