How to handle massive storage of records in database for user authorization purposes?

后端 未结 7 1757
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 09:30

I am using Ruby on Rails 3.2.2 and MySQL. I would like to know if it is \"advisable\" / \"desirable\" to store in a database table related to a class all records related to

相关标签:
7条回答
  • 2021-01-05 10:16

    You should look at a hierarchical role based access control (RBAC) solutions. You should also consider sensible defaults.

    • Are all users allowed to read an article by default? Then store the deny exceptions.

    • Are all users not allowed to read an article by default? Then store the allow exceptions.

    • Does it depend on the article whether the default is allow or deny? Then store that in the article, and store both allow and deny exceptions.

    • Are articles put into issues, and issues collected into journals, and journals collected into fields of knowledge? Then store authorizations between users and those objects.

    • What if a User is allowed to read a Journal but is denied a specific Article? Then store User-Journal:allow, User-Article:deny and the most specific instruction (in this case the article) takes precedence over the more general (in this case the default, and the journal).

    0 讨论(0)
提交回复
热议问题