I have requirement to design a WCF Service based system to filter requests on roles in C#
Rules
User can access X
SuperUser can access Y
Admin can access Z
Database
Resource AccessControl
X User,SuperUser,Admin
Y Admin
Z Admin
How do I create a system where I can transform these accesscontrols into something like a hash or a calculated mathematical value so that I don't have do multiple checks like
If(user = RequestUser.Role.User||user = RequestUser.Role.Admin)
{}
Instead do something like this
Resource AccessControl someCalculatedHashValue
X User,SuperUser,Admin ????
Y Admin ????
Z Admin ????
if(user >= someCalculatedHashValue){}
Note: there could be one to many relationshps