Exemple #1
0
        /// <summary>
        /// Creates a new user with the specified initial password.
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="initialPassword"></param>
        /// <param name="authorityGroups"></param>
        /// <returns></returns>
        public static User CreateNewUser(UserInfo userInfo, Password initialPassword, Iesi.Collections.Generic.ISet<AuthorityGroup> authorityGroups)
        {
			Platform.CheckForNullReference(userInfo, "userInfo");
			Platform.CheckForNullReference(initialPassword, "initialPassword");
			Platform.CheckForEmptyString(userInfo.UserName, "UserName");

            return new User(
                userInfo.UserName,
                initialPassword,
                userInfo.DisplayName,
                userInfo.ValidFrom,
                userInfo.ValidUntil,
                true, // initially enabled
                Platform.Time, // creation time
                null, // last login time
                userInfo.EmailAddress,
                authorityGroups,
                new HashedSet<UserSession>()  // empty session collection
                );
        }
Exemple #2
0
        /// <summary>
		/// Creates a new user with the specified temporary password.
		/// </summary>
        /// <param name="userInfo"></param>
		/// <param name="temporaryPassword"></param>
		/// <returns></returns>
		public static User CreateNewUser(UserInfo userInfo, string temporaryPassword)
        {
			return CreateNewUser(userInfo, Authentication.Password.CreateTemporaryPassword(temporaryPassword), new HashedSet<AuthorityGroup>());
        }