I am eagerly trying to design the perfect multitenant data architecture for my database.
I am getting inspiration from an article posted by Microsoft, based on scenario 3.
I have been given all my tables a tenant-column, and afterwards created a matching VIEW
ALTER TABLE {table_name} add TenantID varbinary(85) DEFAULT SUSER_SID()
CREATE VIEW {view_name}
AS
SELECT *
FROM {table_name}
WHERE TenantID = SUSER_SID()
Each of my clients has their own database user account, these users has been given following rights:
db_datareader
db_datawriter
public
And then I changed the following:
DENY SELECT ON {table_name} TO {user_name}
GRANT SELECT ON {view_name} TO {user_name}
Anyway, am I missing something for now? :)