I have an application which contains different kinds of permissions. As mentioned in (Role Bases Security) RBC ,I grouped users into roles and assigning different permissions to roles. (and permissions are in this style :
public enum Permission {
View = 1,
Create =2,
Edit =4,
Delete =8,
Print = 16
}
everything is ok in simple systems but when the system becomes a little complex , specific permissions come to the system such as :
- View Just His Issued Invoices
- View All Invoices
- Edit Just His Issued Invoices
- Edit All Invoices
- Create Sale Invoice
- Create Purchase Invoice
- Create Proforma
- Create Sale Report On His Own Invoices
- Create Daily Sale Report
- Create Monthly Sale Report -....
As you see different kind of permissions arises in system (it can grows to about 200 different permissions). So the problems are :
- I cannot put them all in one enum . then using binary pattern (1,2,4,8,..) cannot be used because in its best case(int64) it supports up to 64 different permissions.
- a big enum (with about 200 items) is not so good in coding
what are your ideas in this case?
thanks in advance :-)