コード例 #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;
		}
コード例 #2
0
 private static void SetBase(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "base"))
     {
         groups.Base = configSection.GetValue("groups", "base");
     }
 }
コード例 #3
0
 private static void SetFilter(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "filter"))
     {
         groups.Filter = configSection.GetValue("groups", "filter");
     }
 }
コード例 #4
0
 private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "rdnAttribute"))
     {
         groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute");
     }
 }
コード例 #5
0
 private void SetRdnInPath(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "rdnInPath"))
     {
         groups.RdnInPath = configSection.GetValue <bool>("groups", "rdnInPath");
     }
 }
コード例 #6
0
 private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups)
 {
     if (configSection.ContainsKey("groups", "membershipAttribute"))
     {
         groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute");
     }
 }
コード例 #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;
        }
コード例 #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);
     }
 }
コード例 #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;
        }
コード例 #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;
		}
コード例 #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);
        }
コード例 #12
0
		private static void SetBase(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "base")) {
				groups.Base = configSection.GetValue("groups", "base");
			}
		}
コード例 #13
0
		private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "rdnAttribute")) {
				groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute");
			}
		}
コード例 #14
0
		private void SetRdnInPath(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "rdnInPath")) {
				groups.RdnInPath = configSection.GetValue<bool>("groups", "rdnInPath");
			}
		}
コード例 #15
0
		private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "membershipAttribute")) {
				groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute");
			}
		}
コード例 #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);
			}
		}
コード例 #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;
		}
コード例 #18
0
		private static void SetFilter(IConfig configSection, GroupsConfig groups) {
			if(configSection.ContainsKey("groups", "filter")) {
				groups.Filter = configSection.GetValue("groups", "filter");
			}
		}