Exemplo n.º 1
0
	    private void LoadSecureableUnitSearchLoop (Dictionary<String, SecureableUnit> Result, SecureableUnit Start)
		    {
		    Result [Start.NameID] = Start;
		    foreach (SecureableUnit Child in Start.Childs)
			    {
			    LoadSecureableUnitSearchLoop(Result, Child);
			    }
		    }
Exemplo n.º 2
0
		public SecureableUnit LoadSecureableUnits()
			{
			SecureableUnit Start = new SecureableUnit(Modell, SecureableUnitsDataSet.Tables ["SecureableUnits"]
				.Select("ParentID = '" + Guid.Empty.ToString( ) + "'") [0]);
			return Start;
			}
Exemplo n.º 3
0
		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();
			}
Exemplo n.º 4
0
		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;
			}
Exemplo n.º 5
0
	    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;
		    }