public DataRow InsertNewUserRoleForUser (User UserToProcess, UserRole UserRoleToAdd) { DataRow NewRow = SystemSecurityDataSet.Tables ["webpages_UsersInRoles"].NewRow(); NewRow ["ID"] = System.Guid.NewGuid(); NewRow ["UserID"] = UserToProcess.UserID; NewRow ["RoleID"] = UserRoleToAdd.RoleID; SystemSecurityDataSet.Tables ["webpages_UsersInRoles"].Rows.Add(NewRow); UpdateSystemSecurityDataSet(); return NewRow; }
public void DeleteUser (User UserToProcess) { SecuringDirectoryDataWrapper.Instance.DeleteUser(UserToProcess.UserID); int Index = UsersInRoles.Count; while (Index-- < 0) { if (UsersInRoles [Index].UserID == UserToProcess.UserID) UsersInRoles.RemoveAt (Index); } Users.Remove(UserToProcess); }
public void AddNewRoleToUser (User UserToProcess, UserRole UserRoleToAdd) { if (UserToProcess.RolesForThisUser.Contains(UserRoleToAdd)) return; DataRow UserInRoleRow = SecuringDirectoryDataWrapper.Instance.InsertNewUserRoleForUser (UserToProcess, UserRoleToAdd); UserToProcess.RolesForThisUser.Add(UserRoleToAdd); UsersInRoles.Add( new UserInRole(this, UserInRoleRow)); }
public void RemoveRoleFromUser (User UserToProcess, UserRole UserRoleToRemoveFromUser) { if (!(UserToProcess.RolesForThisUser.Contains(UserRoleToRemoveFromUser))) return; SecuringDirectoryDataWrapper.Instance.RemoveUserRoleFromUser(UserToProcess.UserID, UserRoleToRemoveFromUser.RoleID); }
public SecureableAttributeValue GetHighestSecureableAttributeValue (User UserToCheck, SecureableUnit UnitToCheckFor = null) { if (UnitToCheckFor == null) { if (LastUsedUnitWithSecureableAttributes.Count == 0) return null; UnitToCheckFor = LastUsedUnitWithSecureableAttributes [0]; List<SecureableAttribute> UsedSecureableAttribute = new List<SecureableAttribute>(); foreach (UserRole AssignedRole in UserToCheck.RolesForThisUser) { foreach (SecureableAttribute Att in UnitToCheckFor.SecureableAttributesForUnit) if (Att.ConnectedRoleID == AssignedRole.RoleID) { UsedSecureableAttribute.Add(GetInheritatedAtt (Att)); } } int LowestPriority = 0; SecureableAttributeValue HighestPrioritizedAttributeValue = null; foreach (SecureableAttribute Att in UsedSecureableAttribute) { if ((Att.SecureableAttributeValueInstance == null) || (Att.SecureableAttributeValueInstance.Priority < LowestPriority)) continue; LowestPriority = Att.SecureableAttributeValueInstance.Priority; HighestPrioritizedAttributeValue = Att.SecureableAttributeValueInstance; } if (HighestPrioritizedAttributeValue != null) return HighestPrioritizedAttributeValue; } return null; }