views:

48

answers:

0

hi:

Sample of roles:

  1. building:service:land:water:access-granted
  2. building:service:land:water:access-granted (deny)
  3. building:namen:bio:water:science: access-granted

I have to parse a bunch of growing list of roles whereby I need to obtain details based on some of the attributes. The roles are not defined in a database and my application will only notice it when a request for access is made.

In the three role examples above, I need to grant/deny access based on the bolded attributes - the rest I can ignore and is free for whoever that creates roles to define (hey - thats why I work in a windowless, airless room).

Can anyone suggest design pattern to parse through the above?

At the moment, I have written a bunch of nested 'if' statements that look far from beautiful - it works but I was wondering if anyone know of a good design pattern.