- Joined
- Oct 15, 2018
Rust has classes and other such containers though, how are you without OOP?I have written complex permission systems before (namely for Infinity Next), but without OOP I'm not 100% on what to do for it. There is no Rust solution in a crate.
Also, if you are without OOP you could still allocate and populate boolean values in each user's data where each element is a yes/no permission for a certain action. For the sanity of the site staff you could store these permission booleans in a vector so that they can be easily changed when you add or remove areas of the site, and then pair those permission vectors with a vector of strings storing the labels for each permission.
If you still want to have permission groups, you could create lists of permissions (which in this case would be arrays of ints corresponding to the position of certain elements in the permissions vectors, i.e. [2,6,127] for the 2nd, 6th, and 127th perms as a group) and then have a function which checks whether a user has all of the permissions on those lists, and a function which sets all the perms on a list to either true or false.
Sorry if that's not a good solution, I'm not a web developer, but thought I'd chime in since I have some experience with C++ and Rust.
Last edited: