XF 2.0 Get minimum value from integer permission

Lukas W.

Formerly katsulynx
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)?


XenForo developer
Staff member
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
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