Can anyone help?
I am looking to create a good relational model for managing Permissions.
I currently have a Users table, and various other tables like Customers, Suppliers.
The user needs permissions to View, Edit, Create in either Customers, Suppliers.
I will use these tables in EF to decide what access a user has and weather to show a form or not etc.
My original model goes like this, although i think its wrong, as it dosn't state anything about Permissions.
Users UsersCustomers (contains relation between Users and Customers) UsersSuppliers (contains relation between Users and Suppliers) Customers (customer table) Suppliers (suppliers table).
Although this works, i.e. it relates a user to a Customer for example... It just doesn't seem right.
I was thinking of putting a intermediate table called Permissions which woul have a Id and a UserId that would link the user table. Then i could link Permissions to a table like
PermissionsCustomers (in place of UsersCustomers) that would contain a relation between the persmission and customers.
I think this where i am not quite getting an optimum design. Once this design is correct it would be also missing a table to assign what type of permission a user has to a Customer i.e. Edit, Create or only view etc.
I would love to hear some feedback or an example of a strong model that exists that functions like this.
With regards to the customers, suppliers, these are just 2 examples, there will be lots more tables like deliveryLocation, accountsLedger etc.
It would be great if i could do a query that said "Show me all permissions that user X has", currently with my setup i would have to query each Intermediate table separately.
I would be using this via an ORM like entity framework.
A little lost with the structure of the relational model.
Thanks in advance.