My intranet site uses LDAP and Active Directory to authenticate users. There are 2 kinds of Users: Managers and Employees. They are differentiated by having membership in a particular AD group.
In an effort to improve my code I’m trying to use (hopefully appropriately) formal design patterns. I think perhaps a Finite State Machine might work here. But I’m not sure which of the following models (or some other entirely) would be best:
-
2 transitions with simple conditions
Unlogged --- auth==TRUE---> Employee ---group==TRUE---> Manager
-
1 transition with a compound condition
Unlogged --- auth==TRUE && group==FALSE---> Employee
Unlogged --- auth==TRUE && group==TRUE---> Manager
The first feels cleaner. The second is closer to what should actually be happening. Am I on the right track? Would a different design pattern entirely be better?
5