All,
I have created a simple, but maybe complex, permissions structure in my database which comprises of users and groups and their permissions. Essentially put the database has a set of defined permissions (and levels - no, yes, read, write, delete etc) in a table and a user is either added to that permission directly (user permission) or be added to a group and thusly the group is then added to that permission. Of course these group and user permissions then have a selected permission level assigned.
I have added a table with a list of SQL Queries that I wish to dynamically add on the fly and be displayed to the end user via the front end. This way should the user request a specific query it can be created, added and used immediately without requiring the front end to be updated with a button and the SQL behind it.
I wish to restrict the queries to those with the correct permission assigned - the user has to have either the user permission or the group permission and with a permission level higher than no (0). As a result I have included, in the SQL Queries table, the PermissionID that the users or groups with permission they will be able to see.
I am trying to go on the concept of 'lowest permission wins' as a rule of thumb to increase security within the database.
I have created a union query which queries both the users permissions and groups permissions tables to return the lowest permission however this returns the lowest from each query. I, ideally, want a query that will return the lowest value from, as a collective, both queries, not the lowest value from each.
In laymans terms - if the user permission for the SQL queries has a permission level of no (0) and the group permission for the SQL queries has a permission level of yes (1), the query should not return any viewable SQL queries as the lowest value here would be no (0).
I understand that you can do a min on a simple select query but, in Access, can you do a min on the overall union query?
Below I have shown the relationship structure to give you a better understanding of what the current structure.
I have created a simple, but maybe complex, permissions structure in my database which comprises of users and groups and their permissions. Essentially put the database has a set of defined permissions (and levels - no, yes, read, write, delete etc) in a table and a user is either added to that permission directly (user permission) or be added to a group and thusly the group is then added to that permission. Of course these group and user permissions then have a selected permission level assigned.
I have added a table with a list of SQL Queries that I wish to dynamically add on the fly and be displayed to the end user via the front end. This way should the user request a specific query it can be created, added and used immediately without requiring the front end to be updated with a button and the SQL behind it.
I wish to restrict the queries to those with the correct permission assigned - the user has to have either the user permission or the group permission and with a permission level higher than no (0). As a result I have included, in the SQL Queries table, the PermissionID that the users or groups with permission they will be able to see.
I am trying to go on the concept of 'lowest permission wins' as a rule of thumb to increase security within the database.
I have created a union query which queries both the users permissions and groups permissions tables to return the lowest permission however this returns the lowest from each query. I, ideally, want a query that will return the lowest value from, as a collective, both queries, not the lowest value from each.
In laymans terms - if the user permission for the SQL queries has a permission level of no (0) and the group permission for the SQL queries has a permission level of yes (1), the query should not return any viewable SQL queries as the lowest value here would be no (0).
I understand that you can do a min on a simple select query but, in Access, can you do a min on the overall union query?
Below I have shown the relationship structure to give you a better understanding of what the current structure.
