DaveC426913
Programmer
I'm designing a database that manages user access to an education application that contains courses and modules.
A user might have access to x out of y courses, and as well as access to v modules out of w modules inside each course. So, if I'm managing 5 course with 6 modules in each, a worst case scenario would store 30 access rights settings for each user, meaning 30 rows in the table of users vs. courses and modules.
(Additionally, to complicate things, a user might be a member of one or more groups, which also can have the same kinds of access, but that doesn't directly bear on my question.)
My question is this:
Is it good database design to have a table that contains one row for each and every access right to a course and/or module for each user? Even when the data needed is simply binary (permission granted/denied)?
I have seen a method used where lots of binary data can be stored compactly by using a bit mask - requiring only one row per user.
eg. A user with access rights to modules 1,2,4 and 5 will have their value stored as 11011 (stored as integer 27). This means a small and fixed number of rows per user. (The downside of course, is that it places an upper limit on the total number that can be stored, based on what sized integer you use).
Advice?
A user might have access to x out of y courses, and as well as access to v modules out of w modules inside each course. So, if I'm managing 5 course with 6 modules in each, a worst case scenario would store 30 access rights settings for each user, meaning 30 rows in the table of users vs. courses and modules.
(Additionally, to complicate things, a user might be a member of one or more groups, which also can have the same kinds of access, but that doesn't directly bear on my question.)
My question is this:
Is it good database design to have a table that contains one row for each and every access right to a course and/or module for each user? Even when the data needed is simply binary (permission granted/denied)?
I have seen a method used where lots of binary data can be stored compactly by using a bit mask - requiring only one row per user.
eg. A user with access rights to modules 1,2,4 and 5 will have their value stored as 11011 (stored as integer 27). This means a small and fixed number of rows per user. (The downside of course, is that it places an upper limit on the total number that can be stored, based on what sized integer you use).
Advice?