private void LoadSecureableUnitSearchLoop (Dictionary<String, SecureableUnit> Result, SecureableUnit Start) { Result [Start.NameID] = Start; foreach (SecureableUnit Child in Start.Childs) { LoadSecureableUnitSearchLoop(Result, Child); } }
public SecureableUnit LoadSecureableUnits() { SecureableUnit Start = new SecureableUnit(Modell, SecureableUnitsDataSet.Tables ["SecureableUnits"] .Select("ParentID = '" + Guid.Empty.ToString( ) + "'") [0]); return Start; }
public void AddUnitWithChangeableAttributes(SecureableUnit SelectedSecureableUnit) { if (SelectedSecureableUnit == null) return; SelectedSecureableUnit.IsSelectedAsTemplate = false; if (Parent.LastUsedUnitWithSecureableAttributes.Contains(SelectedSecureableUnit)) { Parent.LastUsedUnitWithSecureableAttributes.Remove(SelectedSecureableUnit); } SelectedSecureableUnit.IsEnabled = true; Parent.LastUsedUnitWithSecureableAttributes.Insert(0, SelectedSecureableUnit); if (Parent.LastUsedUnitWithSecureableAttributes.Count > 1) Parent.LastUsedUnitWithSecureableAttributes[1].IsEnabled = false; SelectedSecureableUnit.ReorderLastUsedUnitWithSecureableAttributes(); Parent.SendPropertyChanged("LastUsedUnitWithSecureableAttributes"); Parent.SendPropertyChanged(); }
public static SecureableUnit GetClassFromID (SecureableUnit StartUnit, Guid ID) { if (StartUnit.ID == ID) return StartUnit; foreach (SecureableUnit Child in StartUnit.Childs) { SecureableUnit Return = GetClassFromID(Child, ID); if (Return != null) return Return; } return null; }
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; }