public void Roles_Defined_In_Restriction_Object_Cant_Exist_At_Same_Time() { Role[] roles = new Role[] { Factory.Role("Role 1"), Factory.Role("Role 3"), Factory.Role("Role 7"), Factory.Role("Role 10") }; Restriction r1 = new Restriction(1, 3, 7, 10); Assert.IsFalse(r1.isValid(roles)); Restriction r2 = new Restriction(1, 10); Assert.IsFalse(r2.isValid(roles)); Restriction r3 = new Restriction(15, 20); Assert.IsTrue(r3.isValid(roles)); Restriction r4 = new Restriction(1); Assert.IsTrue(r4.isValid(roles)); }
private Role GetRolesRecursive(Role currentRole, ref List<Role> roles) { roles.Add(currentRole); foreach (Role role in currentRole.Childs) { GetRolesRecursive(role, ref roles); } return null; }
private List<Role> GetAllChildRoles(Role[] roles) { List<Role> allRoles = new List<Role>(); foreach(Role r in roles) { GetRolesRecursive(r, ref allRoles); } return allRoles; }
private List<Role> GetAllChildRoles(Role role) { List<Role> roles = new List<Role>(); GetRolesRecursive(role, ref roles); return roles; }
public Session(User user, Role[] roles) { this.user = user; this.roles = roles; this.sessionInitTime = DateTime.Now; }