Ejemplo n.º 1
0
		private static void SetPath(IConfig configSection, GroupsConfig groups) {
			var groupUri = new Uri(configSection.GetValue("url"));
			if(!String.IsNullOrEmpty(groups.Base)) {
				groupUri = new Uri(groupUri, groups.Base);
			}
			groups.Path = groupUri.OriginalString;
		}
Ejemplo n.º 2
0
 private static void SetBase(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "base"))
     {
         groups.Base = configSection.GetValue("groups", "base");
     }
 }
Ejemplo n.º 3
0
 private static void SetFilter(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "filter"))
     {
         groups.Filter = configSection.GetValue("groups", "filter");
     }
 }
Ejemplo n.º 4
0
 private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "rdnAttribute"))
     {
         groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute");
     }
 }
Ejemplo n.º 5
0
 private void SetRdnInPath(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "rdnInPath"))
     {
         groups.RdnInPath = configSection.GetValue <bool>("groups", "rdnInPath");
     }
 }
Ejemplo n.º 6
0
 private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "membershipAttribute"))
     {
         groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute");
     }
 }
Ejemplo n.º 7
0
        private static void SetAttributeDefinitionList(IConfig configSection, GroupsConfig groups)
        {
            var containsCustomAttributes = configSection.ContainsKey("groups", "attributes");
            var attributes = new List <IAttributeDefinition>(groups.Attributes);

            if (containsCustomAttributes)
            {
                attributes.Clear();
            }
            attributes.Attach(groups.MembershipAttribute, true);
            if (containsCustomAttributes)
            {
                var attributeValues = configSection.GetValueArray("groups/attributes", "attribute");
                foreach (var attribute in attributeValues)
                {
                    var excludeFromNameSearch = false;
                    var attributeKey          = String.Format("groups/attributes/attribute[@value='{0}']", attribute);
                    if (configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch"))
                    {
                        excludeFromNameSearch = configSection.GetAttribute <bool>(attributeKey, "excludeFromNameSearch");
                    }
                    attributes.Attach(attribute, excludeFromNameSearch);
                }
            }
            groups.Attributes = attributes;
        }
Ejemplo n.º 8
0
 private static void SetNameType(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "nameType"))
     {
         var nameType = configSection.GetValue("groups", "nameType");
         groups.NameType = (NameType)Enum.Parse(typeof(NameType), nameType, true);
     }
 }
Ejemplo n.º 9
0
        private static void SetPath(IConfig configSection, GroupsConfig groups)
        {
            var groupUri = new Uri(configSection.GetValue("url"));

            if (!String.IsNullOrEmpty(groups.Base))
            {
                groupUri = new Uri(groupUri, groups.Base);
            }
            groups.Path = groupUri.OriginalString;
        }
Ejemplo n.º 10
0
		public IGroupsConfig Create(IConfig configSection) {
			if(configSection == null) {
				throw new ArgumentNullException("configSection");
			}
			var groups = new GroupsConfig();
			SetFilter(configSection, groups);
			SetBase(configSection, groups);
			SetRdnAttribute(configSection, groups);
			SetRdnInPath(configSection, groups);
			SetMembershipAttribute(configSection, groups);
			SetNameType(configSection, groups);
			SetPath(configSection, groups);
			SetAttributeDefinitionList(configSection, groups);
			return groups;
		}
Ejemplo n.º 11
0
        public IGroupsConfig Create(IConfig configSection)
        {
            if (configSection == null)
            {
                throw new ArgumentNullException("configSection");
            }
            var groups = new GroupsConfig();

            SetFilter(configSection, groups);
            SetBase(configSection, groups);
            SetRdnAttribute(configSection, groups);
            SetRdnInPath(configSection, groups);
            SetMembershipAttribute(configSection, groups);
            SetNameType(configSection, groups);
            SetPath(configSection, groups);
            SetAttributeDefinitionList(configSection, groups);
            return(groups);
        }
Ejemplo n.º 12
0
		private static void SetBase(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "base")) {
				groups.Base = configSection.GetValue("groups", "base");
			}
		}
Ejemplo n.º 13
0
		private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "rdnAttribute")) {
				groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute");
			}
		}
Ejemplo n.º 14
0
		private void SetRdnInPath(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "rdnInPath")) {
				groups.RdnInPath = configSection.GetValue<bool>("groups", "rdnInPath");
			}
		}
Ejemplo n.º 15
0
		private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "membershipAttribute")) {
				groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute");
			}
		}
Ejemplo n.º 16
0
		private static void SetNameType(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "nameType")) {
				var nameType = configSection.GetValue("groups", "nameType");
				groups.NameType = (NameType)Enum.Parse(typeof(NameType), nameType, true);
			}
		}
Ejemplo n.º 17
0
		private static void SetAttributeDefinitionList(IConfig configSection, GroupsConfig groups) {
			var containsCustomAttributes = configSection.ContainsKey("groups", "attributes");
			var attributes = new List<IAttributeDefinition>(groups.Attributes);
			if(containsCustomAttributes) {
				attributes.Clear();
			}
			attributes.Attach(groups.MembershipAttribute, true);
			if(containsCustomAttributes) {
				var attributeValues = configSection.GetValueArray("groups/attributes", "attribute");
				foreach(var attribute in attributeValues) {
					var excludeFromNameSearch = false;
					var attributeKey = String.Format("groups/attributes/attribute[@value='{0}']", attribute);
					if(configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch")) {
						excludeFromNameSearch = configSection.GetAttribute<bool>(attributeKey, "excludeFromNameSearch");
					}
					attributes.Attach(attribute, excludeFromNameSearch);
				}
			}
			groups.Attributes = attributes;
		}
Ejemplo n.º 18
0
		private static void SetFilter(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "filter")) {
				groups.Filter = configSection.GetValue("groups", "filter");
			}
		}