openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
654 stars 384 forks source link

New permissions / users groups system for confirmed users, moderators, admins and producers #2085

Closed stephanegigandet closed 4 years ago

stephanegigandet commented 5 years ago

This is to replace the current list of hardcoded usernames for admins.

Proposal:

Instead of having one checkbox for each individual feature (e.g. "allow to move products", "allow to delete products", "enable quick edit fields", "protect edits" (for producers), "allow edits of protected edits" (for experimented users), which would force us to go through all power users profiles whenever we add a new feature, we can try to instead have a small number of user groups or feature sets.

e.g.

For producers, it would be useful to be able to list the corresponding brands as well.

VaiTon commented 5 years ago

We could use a permission system based on "nodes" (eg. "admin.image.move") and then groups have the main prefix (eg. "admin.*") and the software gives them all sub-permissions

hangy commented 5 years ago

We could use a permission system based on "nodes" (eg. "admin.image.move") and then groups have the main prefix (eg. "admin.*") and the software gives them all sub-permissions

I was thinking something similar. It might be interesting to have something similar to RBAC as implemented in Apache Shiro. Interestingly enough, there's not that many RBAC modules on CPAN.

stephanegigandet commented 5 years ago

We can hopefully find something simple. https://metacpan.org/pod/RBAC::Tiny seems ok, except I'd like to be able to give multiple roles to a single user.

stephanegigandet commented 4 years ago

OK, this group system is badly needed, especially for the producers platform, and also to remove the hardcoded user names from the code. So I made something really simple but that works. At this point I don't think we need to over-engineer this.

Here what it looks like in the product edit form, which is available only for admins. There will be much fewer admins, and many more moderators (who will be able to do everything admins can do, except changing user groups).

image

stephanegigandet commented 4 years ago

Deployed.