A
A
Arman2016-12-18 17:09:37
Software design
Arman, 2016-12-18 17:09:37

What for the list of permissions/permissions in a DB?

I watched a bunch of admin panels, articles and videos, a table with permissions is created everywhere, but these permissions are empty entries without implementation in the code, there is a big chance of typos or storing outdated data, again, somehow it is necessary to maintain relevance on the production server, test and developers machines.
Now I am raising a new admin panel and decided why not store permissions in a simple array? Either the constants of which permission class, in the admin panel already show this data for role assignments, so it will be exactly the implementation first, the relevance of the code, and only then the entries in the database.
What could be the catch? What for all the same permissions in a DB? Have you had experience with this? Do migrations keep the table with permissions up to date?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2016-12-18
@DmitriyEntelis

In general, a classic solution from the time when memory was expensive - to store rights as a binary mask of the form 0101011101 - in which the role being determined depended stupidly on the bit number.
The problems that arise with this approach are quite obvious.
What exactly do you mean by "why not store permissions in a simple array" and "Why all the same permissions in the database?" It's not very clear from your question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question