コード例 #1
0
 private static void SetLastLoginDateAttribute(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "lastLoginDateAttribute"))
     {
         users.LastLoginDateAttribute = configSection.GetValue("users", "lastLoginDateAttribute");
     }
 }
コード例 #2
0
 private static void SetEmailAttribute(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "emailAttribute"))
     {
         users.EmailAttribute = configSection.GetValue("users", "emailAttribute");
     }
 }
コード例 #3
0
 private static void SetMembershipAttribute(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "membershipAttribute"))
     {
         users.MembershipAttribute = configSection.GetValue("users", "membershipAttribute");
     }
 }
コード例 #4
0
 private static void SetBase(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "base"))
     {
         users.Base = configSection.GetValue("users", "base");
     }
 }
コード例 #5
0
        public IUsersConfig Create(IConfig configSection)
        {
            var users = new UsersConfig();

            if (configSection == null)
            {
                throw new ArgumentNullException("configSection");
            }

            SetFilter(configSection, users);
            SetBase(configSection, users);
            SetRdnAttribute(configSection, users);
            SetMembershipAttribute(configSection, users);
            SetEmailAttribute(configSection, users);
            SetCreationDateAttribute(configSection, users);
            SetLastLoginDateAttribute(configSection, users);
            SetLastPasswordChangedDateAttribute(configSection, users);
            SetDescriptionAttribute(configSection, users);
            SetNameType(configSection, users);
            SetPath(configSection, users);
            SetMemershipUserWrappingEnabled(configSection, users);
            SetAttributeDefinitionList(configSection, users);

            return(users);
        }
コード例 #6
0
 private static void SetMemershipUserWrappingEnabled(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "membershipUserWrappingEnabled"))
     {
         users.MembershipUserWrappingEnabled = configSection.GetValue <bool>("users", "membershipUserWrappingEnabled");
     }
 }
コード例 #7
0
        private static void SetAttributeDefinitionList(IConfig configSection, UsersConfig users)
        {
            var containsCustomAttributes = configSection.ContainsKey("users", "attributes");
            var attributes = new List <IAttributeDefinition>(users.Attributes);

            if (containsCustomAttributes)
            {
                attributes.Clear();
            }
            attributes.Attach(users.EmailAttribute, true);
            attributes.Attach(users.CreationDateAttribute, true);
            attributes.Attach(users.LastLoginDateAttribute, true);
            attributes.Attach(users.LastPasswordChangedDateAttribute, true);
            attributes.Attach(users.DescriptionAttribute, true);
            attributes.Attach(users.MembershipAttribute, true);
            if (containsCustomAttributes)
            {
                var attributeValues = configSection.GetValueArray("users/attributes", "attribute");
                foreach (var attribute in attributeValues)
                {
                    var excludeFromNameSearch = false;
                    var attributeKey          = String.Format("users/attributes/attribute[@value='{0}']", attribute);
                    if (configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch"))
                    {
                        excludeFromNameSearch = configSection.GetAttribute <bool>(attributeKey, "excludeFromNameSearch");
                    }
                    attributes.Attach(attribute, excludeFromNameSearch);
                }
            }
            users.Attributes = attributes;
        }
コード例 #8
0
 private static void SetFilter(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "filter"))
     {
         users.Filter = configSection.GetValue("users", "filter");
     }
 }
コード例 #9
0
 private static void SetDescriptionAttribute(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "descriptionAttribute"))
     {
         users.DescriptionAttribute = configSection.GetValue("users", "descriptionAttribute");
     }
 }
コード例 #10
0
 private static void SetNameType(IConfig configSection, UsersConfig users)
 {
     if (configSection.ContainsKey("users", "nameType"))
     {
         var nameType = configSection.GetValue("users", "nameType");
         users.NameType = (NameType)Enum.Parse(typeof(NameType), nameType, true);
     }
 }
コード例 #11
0
        private static void SetPath(IConfig configSection, UsersConfig users)
        {
            var userUri = new Uri(configSection.GetValue("url"));

            if (!String.IsNullOrEmpty(users.Base))
            {
                userUri = new Uri(userUri, users.Base);
            }
            users.Path = userUri.OriginalString;
        }
コード例 #12
0
		public IUsersConfig Create(IConfig configSection) {
			var users = new UsersConfig();
			if(configSection == null) {
				throw new ArgumentNullException("configSection");
			}

			SetFilter(configSection, users);
			SetBase(configSection, users);
			SetRdnAttribute(configSection, users);
			SetMembershipAttribute(configSection, users);
			SetEmailAttribute(configSection, users);
			SetCreationDateAttribute(configSection, users);
			SetLastLoginDateAttribute(configSection, users);
			SetLastPasswordChangedDateAttribute(configSection, users);
			SetDescriptionAttribute(configSection, users);
			SetNameType(configSection, users);
			SetPath(configSection, users);
			SetMemershipUserWrappingEnabled(configSection, users);
			SetAttributeDefinitionList(configSection, users);

			return users;
		}
コード例 #13
0
		private static void SetNameType(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "nameType")) {
				var nameType = configSection.GetValue("users", "nameType");
				users.NameType = (NameType)Enum.Parse(typeof(NameType), nameType, true);
			}
		}
コード例 #14
0
		private static void SetMemershipUserWrappingEnabled(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "membershipUserWrappingEnabled")) {
				users.MembershipUserWrappingEnabled = configSection.GetValue<bool>("users", "membershipUserWrappingEnabled");
			}
		}
コード例 #15
0
		private static void SetEmailAttribute(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "emailAttribute")) {
				users.EmailAttribute = configSection.GetValue("users", "emailAttribute");
			}
		}
コード例 #16
0
		private static void SetMembershipAttribute(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "membershipAttribute")) {
				users.MembershipAttribute = configSection.GetValue("users", "membershipAttribute");
			}
		}
コード例 #17
0
		private static void SetFilter(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "filter")) {
				users.Filter = configSection.GetValue("users", "filter");
			}
		}
コード例 #18
0
		private static void SetBase(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "base")) {
				users.Base = configSection.GetValue("users", "base");
			}
		}
コード例 #19
0
		private static void SetAttributeDefinitionList(IConfig configSection, UsersConfig users) {
			var containsCustomAttributes = configSection.ContainsKey("users", "attributes");
			var attributes = new List<IAttributeDefinition>(users.Attributes);
			if(containsCustomAttributes) {
				attributes.Clear();
			}
			attributes.Attach(users.EmailAttribute, true);
			attributes.Attach(users.CreationDateAttribute, true);
			attributes.Attach(users.LastLoginDateAttribute, true);
			attributes.Attach(users.LastPasswordChangedDateAttribute, true);
			attributes.Attach(users.DescriptionAttribute, true);
			attributes.Attach(users.MembershipAttribute, true);
			if(containsCustomAttributes) {
				var attributeValues = configSection.GetValueArray("users/attributes", "attribute");
				foreach(var attribute in attributeValues) {
					var excludeFromNameSearch = false;
					var attributeKey = String.Format("users/attributes/attribute[@value='{0}']", attribute);
					if(configSection.ContainsAttribute(attributeKey, "excludeFromNameSearch")) {
						excludeFromNameSearch = configSection.GetAttribute<bool>(attributeKey, "excludeFromNameSearch");
					}
					attributes.Attach(attribute, excludeFromNameSearch);
				}
			}
			users.Attributes = attributes;
		}
コード例 #20
0
		private static void SetCreationDateAttribute(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "creationDateAttribute")) {
				users.CreationDateAttribute = configSection.GetValue("users", "creationDateAttribute");
			}
		}
コード例 #21
0
		private static void SetPath(IConfig configSection, UsersConfig users) {
			var userUri = new Uri(configSection.GetValue("url"));
			if(!String.IsNullOrEmpty(users.Base)) {
				userUri = new Uri(userUri, users.Base);
			}
			users.Path = userUri.OriginalString;
		}
コード例 #22
0
		private static void SetLastPasswordChangedDateAttribute(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "lastPasswordChangedDateAttribute")) {
				users.LastPasswordChangedDateAttribute = configSection.GetValue("users", "lastPasswordChangedDateAttribute");
			}
		}
コード例 #23
0
		private static void SetDescriptionAttribute(IConfig configSection, UsersConfig users) {
			if(configSection.ContainsKey("users", "descriptionAttribute")) {
				users.DescriptionAttribute = configSection.GetValue("users", "descriptionAttribute");
			}
		}