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; }
private static void SetBase(IConfig configSection, GroupsConfig groups) { if (configSection.ContainsKey("groups", "base")) { groups.Base = configSection.GetValue("groups", "base"); } }
private static void SetFilter(IConfig configSection, GroupsConfig groups) { if (configSection.ContainsKey("groups", "filter")) { groups.Filter = configSection.GetValue("groups", "filter"); } }
private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups) { if (configSection.ContainsKey("groups", "rdnAttribute")) { groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute"); } }
private void SetRdnInPath(IConfig configSection, GroupsConfig groups) { if (configSection.ContainsKey("groups", "rdnInPath")) { groups.RdnInPath = configSection.GetValue <bool>("groups", "rdnInPath"); } }
private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups) { if (configSection.ContainsKey("groups", "membershipAttribute")) { groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute"); } }
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; }
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); } }
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; }
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; }
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); }
private static void SetBase(IConfig configSection, GroupsConfig groups) { if(configSection.ContainsKey("groups", "base")) { groups.Base = configSection.GetValue("groups", "base"); } }
private static void SetRdnAttribute(IConfig configSection, GroupsConfig groups) { if(configSection.ContainsKey("groups", "rdnAttribute")) { groups.RdnAttribute = configSection.GetValue("groups", "rdnAttribute"); } }
private void SetRdnInPath(IConfig configSection, GroupsConfig groups) { if(configSection.ContainsKey("groups", "rdnInPath")) { groups.RdnInPath = configSection.GetValue<bool>("groups", "rdnInPath"); } }
private static void SetMembershipAttribute(IConfig configSection, GroupsConfig groups) { if(configSection.ContainsKey("groups", "membershipAttribute")) { groups.MembershipAttribute = configSection.GetValue("groups", "membershipAttribute"); } }
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); } }
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; }
private static void SetFilter(IConfig configSection, GroupsConfig groups) { if(configSection.ContainsKey("groups", "filter")) { groups.Filter = configSection.GetValue("groups", "filter"); } }