Not sure if mySQL allows for this, but am curious if it is.
I have a simple ACL db, there are channels and users. Some users have access to specific channels, others have access to all of them. My preferred method would not be to have a row in the permissions table for each user’s channel, but to specify that if the channel id column in a user’s row is NULL then they have access to any channel. In other words…
channels
1 | channelA
2 | channelB
etc...
users_access
1 | NULL // this user has access to all channels
2 | 2 // this user only has access to channel 2
Is there a way to write a select that returns 1 and 2 for user 1 (based on the NULL) and just 2 for user 2?
Again… I recognize that the alternative design is to simply have a unique row in the user’s table for each channel they have the rights to, but for various reasons that I don’t wish to get into, I’d prefer to have a global NULL access value.
TIA
or:
You could also restructure your tables, keeping the
users_accessfor the information about users with access to specific channels and adding ausers_global_accessfor users with access to all channels (possibly with just one column,user_id, or with other relevant info, like start_date, etc.)