Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fAuthorization should accept raw user levels

posted by rirez 7 years ago

fAuthorization's setUserAuthLevel function currently only accepts the strings set via setAuthLevels. It's been extremely irritating for me, as I'm currently writing a library around Flourish.

As a library, I don't know what the end user will set as their auth levels. I would much prefer to store user auth levels in the database as integers (the ability to run math SQL on it, smaller sizes, etc), but then my library has no way to translate these integers into the strings setUserAuthLevel accepts. The internal structure is kept private away from me.

I would really enjoy being able to store the user levels as integers, because they provide a lot more usability. In a personal project, I could use an enum, but as a library, I don't know what the user will use.

My current workaround is to have the user declare the authLevel array into my library's classes, and use that for translating database integers (as well as passing it to fAuthorization as well). It just doesn't seem as neat as it should be.