예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ユーザー"/> class
        /// and publishes a <see cref="ユーザー登録時"/> event.
        /// </summary>
        /// <param name="tenantId">
        /// Initial value of the <see cref="TenantId"/> property.
        /// </param>
        /// <param name="username">
        /// Initial value of the <see cref="Username"/> property.
        /// </param>
        /// <param name="password">
        /// Initial value of the <see cref="Password"/> property.
        /// </param>
        /// <param name="enablement">
        /// Initial value of the <see cref="Enablement"/> property.
        /// </param>
        /// <param name="person">
        /// Initial value of the <see cref="Person"/> property.
        /// </param>
        public ユーザー(
			テナントId tenantId,
			string username,
			string password,
			有効化 enablement,
			人 person)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenantId is required.");
            AssertionConcern.AssertArgumentNotNull(person, "The person is required.");
            AssertionConcern.AssertArgumentNotEmpty(username, "The username is required.");
            AssertionConcern.AssertArgumentLength(username, 3, 250, "The username must be 3 to 250 characters.");

            // Defer validation to the property setters.
            this.Enablement = enablement;
            this.Person = person;
            this.TenantId = tenantId;
            this.Username = username;

            this.ProtectPassword(string.Empty, password);

            person.User = this;

            DomainEventPublisher
                .Instance
                .Publish(new ユーザー登録時(
                        tenantId,
                        username,
                        person.Name,
                        person.ContactInformation.EmailAddress));
        }
예제 #2
0
        public void DefineEnablement(有効化 enablement)
        {
            this.Enablement = enablement;

            DomainEventPublisher
                .Instance
                .Publish(new ユーザー有効化変更時(
                        this.TenantId,
                        this.Username,
                        this.Enablement));
        }
예제 #3
0
        public ユーザー RegisterUser(string invitationIdentifier, string username, string password, 有効化 enablement, 人 person)
        {
            AssertionConcern.AssertStateTrue(this.Active, "Tenant is not active.");

            ユーザー user = null;
            if (this.IsRegistrationAvailableThrough(invitationIdentifier))
            {
                // ensure same tenant
                person.TenantId = this.TenantId;
                user = new ユーザー(this.TenantId, username, password, enablement, person);
            }

            return user;
        }