'How can I organize Role Based Access Control (?) in my scenario?

I have a database where there are products grouped by categories.

When a user registers, he selects a category, which cannot be changed. The user will be able to perform some actions only on the products of that category, and some other actions on products of other categories as well. E.g. a user can comment on a product only in his category, or put a like on a product in another category.

A user with "superpowers" becomes a Moderator. He can do everything a user does, plus the ability to change something made by another user. E.g. he can modify a comment written by another user but always in reference to a product of the category he belongs to.

Then there are the Admins, who are Moderators who, however, can work independently of the category.

How can I set up the tables for this scenario?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source