This is a controversial issue, as I no longer participate in this project, but it continues to bother me. I wonder if anyone has a better idea for future references and general good programming techniques.
A security approach for textbooks is role-based security. Each screen, report, or other task is tied to one or more roles; each user is assigned one or more roles; and then each user can use screens, etc. that correspond to his roles and nothing more. Correctly?
A few years ago, I led a team developing a military technical management system. Each manual had a “technical content manager” responsible for writing or editing it; “fund manager” responsible for tracking copies and sending them; and the "administrative manager" responsible for the budget, and therefore decided how often the book would be reviewed, how many copies would be printed, etc. Of course, in every book there were many people who ordered copies and read them. (Since it was the military, you had to get permission to get books, security permissions and all that.) Usually we didn’t worry about real readers, but about the people at each base who managed the libraries, but this is really not relevant.
So ... these are obvious "roles", but the role was tied to a specific book. One person may be the technical content manager for book A, the administrative manager of book B, and a reader of 50 other books. Therefore, we could not say that the user has a "role". Each user had different roles for each book.
In addition to this, there were more ordinary privileges at the system level: we had several system administrators who were allowed to update something on the system, help services that could see almost any data, but not update, etc.
As a result, I created such a database. (In order not to fall into any of our strange terminology, I will change the names of the fields and tables here, the idea is the same.)
Person (person_id, name, etc.)
Technical_Manual (manual_id, title, admin_manager_person_id, stock_manager_person_id, content_manager_person_id, etc.)
Authorized_Reader (manual_id, person_id, etc.)
User (user_id, admin_role, etc.)
I was not very happy with this scheme, as it meant that security was divided into three tables: a technical table, an authorized_reader table, and a user table. But ... was there a cleaner way we could do this? Any better ideas?