G
G
godpop2015-11-29 14:19:48
PHP
godpop, 2015-11-29 14:19:48

What is the best storage option?

Good afternoon. Which option for storing user permissions (what can he do, what can't he do) is better to store?
1) permissions table and fields in it: group - user group, newsADD, newsEDIT, newsDELETE, where I set 1 - possible, 0 - impossible
2) permissions table and fields in it: group - user group, valuePerm - value what is possible, and what not: newsADD, newsEDIT, newsDELETE
In the first case, all fields are already defined, while in the second, permission values ​​can be added.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Marat, 2015-11-29
@godpop

Do you consider using third-party systems for setting rights and authentication?
If there are few audit objects (news, comments, etc.), then the 1st one is better: it
takes up less space, eight combinations of permissions for rights in one table entry
. audit), since in the first case you will have to add the extension of the first table. It will be done by adding fields (for example, commentAdd, commentEdit, commentDelete, etc.). And perhaps the records in the table will be very sparse in this case.
PS In general (if you don't use a third-party solution), it's better to structure it a bit (if there are other audit objects in addition to news):
- Audit object tables, Operation type, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question