public void ProvisionRole(プロビジョンロールコマンド command)
 {
     var tenantId = new テナントId(command.TenantId);
     var tenant = this.tenantRepository.Get(tenantId);
     var role = tenant.ProvisionRole(command.RoleName, command.Description, command.SupportsNesting);
     this.roleRepository.Add(role);
 }
 public ロールプロビジョン時(テナントId tenantId, string name)
 {
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
 }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="人"/> class.
 /// </summary>
 /// <param name="tenantId">
 /// Initial value of the <see cref="TenantId"/> property.
 /// </param>
 /// <param name="name">
 /// Initial value of the <see cref="Name"/> property.
 /// </param>
 /// <param name="contactInformation">
 /// Initial value of the <see cref="ContactInformation"/> property.
 /// </param>
 public 人(テナントId tenantId, フルネーム name, コンタクト情報 contactInformation)
 {
     // Defer validation to the property setters.
     this.ContactInformation = contactInformation;
     this.Name = name;
     this.TenantId = tenantId;
 }
 public グループグループ削除時(テナントId tenantId, string groupName, string nestedGroupName)
 {
     this.EventVersion = 1;
     this.GroupName = groupName;
     this.NestedGroupName = nestedGroupName;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="グループ"/> class.
 /// </summary>
 /// <param name="tenantId">
 /// Initial value of the <see cref="TenantId"/> property.
 /// </param>
 /// <param name="name">
 /// Initial value of the <see cref="Name"/> property.
 /// </param>
 /// <param name="description">
 /// Initial value of the <see cref="Description"/> property.
 /// </param>
 public グループ(テナントId tenantId, string name, string description)
     : this()
 {
     // Defer validation to the property setters.
     this.Description = description;
     this.Name = name;
     this.TenantId = tenantId;
 }
 public グループユーザー削除時(テナントId tenantId, string groupName, string username)
 {
     this.EventVersion = 1;
     this.GroupName = groupName;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
     this.Username = username;
 }
 public ユーザーロールアサイン解除時(テナントId tenantId, string roleName, string username)
 {
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.RoleName = roleName;
     this.TenantId = tenantId;
     this.Username = username;
 }
Exemplo n.º 9
0
 public 招待記述子(テナントId tenantId, string invitationId, string description, DateTime startingOn, DateTime until)
 {
     this.Description = description;
     this.InvitationId = invitationId;
     this.StartingOn = startingOn;
     this.TenantId = tenantId.Id;
     this.Until = until;
 }
 public グループロールアサイン時(テナントId tenantId, string roleName, string groupName)
 {
     this.EventVersion = 1;
     this.GroupName = groupName;
     this.OccurredOn = DateTime.Now;
     this.RoleName = roleName;
     this.TenantId = tenantId;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Determines whether a <see cref="ユーザー"/> has a <see cref="ロール"/>,
        /// given the names of the user and the role.
        /// </summary>
        /// <param name="tenantId">
        /// A <see cref="テナントId"/> identifying a <see cref="テナント"/> with
        /// which a <see cref="ユーザー"/> and <see cref="ロール"/> are associated.
        /// </param>
        /// <param name="username">
        /// The unique username identifying a <see cref="ユーザー"/>.
        /// </param>
        /// <param name="roleName">
        /// The unique name identifying a <see cref="ロール"/>.
        /// </param>
        /// <returns>
        /// <c>true</c> if the <see cref="ユーザー"/> has the
        /// <see cref="ロール"/>; otherwise, <c>false</c>.
        /// </returns>
        public bool IsUserInRole(テナントId tenantId, string username, string roleName)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "TenantId must not be null.");
            AssertionConcern.AssertArgumentNotEmpty(username, "Username must not be provided.");
            AssertionConcern.AssertArgumentNotEmpty(roleName, "Role name must not be null.");

            ユーザー user = this.userRepository.UserWithUsername(tenantId, username);
            return ((user != null) && this.IsUserInRole(user, roleName));
        }
 public ユーザーパスワード変更時(
         テナントId tenantId,
         String username)
 {
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
     this.Username = username;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ロール"/> class.
        /// </summary>
        /// <param name="tenantId">
        /// Initial value of the <see cref="TenantId"/> property.
        /// </param>
        /// <param name="name">
        /// Initial value of the <see cref="Name"/> property.
        /// </param>
        /// <param name="description">
        /// Initial value of the <see cref="Description"/> property.
        /// </param>
        /// <param name="supportsNesting">
        /// Initial value of the <see cref="SupportsNesting"/> property.
        /// </param>
        public ロール(テナントId tenantId, string name, string description, bool supportsNesting)
        {
            // Defer validation to the property setters.
            this.Description = description;
            this.Name = name;
            this.SupportsNesting = supportsNesting;
            this.TenantId = tenantId;

            this.internalGroup = this.CreateInternalGroup();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="グループメンバー"/> class,
        /// restricted to internal access.
        /// </summary>
        /// <param name="tenantId">
        /// Initial value of the <see cref="TenantId"/> property.
        /// </param>
        /// <param name="name">
        /// Initial value of the <see cref="Name"/> property.
        /// </param>
        /// <param name="type">
        /// Initial value of the <see cref="Type"/> property.
        /// </param>
        /// <remarks>
        /// This constructor is invoked by the <see cref="ユーザー.ToGroupMember"/>
        /// or <see cref="グループ.ToGroupMember"/> factory methods of
        /// <see cref="ユーザー"/> or <see cref="グループ"/>, respectively.
        /// </remarks>
        internal グループメンバー(テナントId tenantId, string name, グループメンバータイプ type)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenantId must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(name, "Member name is required.");
            AssertionConcern.AssertArgumentLength(name, 1, 100, "Member name must be 100 characters or less.");

            this.Name = name;
            this.TenantId = tenantId;
            this.Type = type;
        }
Exemplo n.º 15
0
 public 人名変更時(
         テナントId tenantId,
         String username,
         フルネーム name)
 {
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
     this.Username = username;
 }
 public 人コンタクト情報変更時(
         テナントId tenantId,
         String username,
         コンタクト情報 contactInformation)
 {
     this.ContactInformation = contactInformation;
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
     this.Username = username;
 }
 public void AssignUserToRole(ユーザーをロールにアサインコマンド command)
 {
     var tenantId = new テナントId(command.TenantId);
     var user = this.userRepository.UserWithUsername(tenantId, command.Username);
     if (user != null)
     {
         var role = this.roleRepository.RoleNamed(tenantId, command.RoleName);
         if (role != null)
         {
             role.AssignUser(user);
         }
     }
 }
 public ユーザー登録時(
         テナントId tenantId,
         String username,
         フルネーム name,
         Emailアドレス emailAddress)
 {
     this.EmailAddress = emailAddress;
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
     this.Username = username;
 }
Exemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="テナント"/> class.
        /// </summary>
        /// <param name="tenantId">
        /// Initial value of the <see cref="TenantId"/> property.
        /// </param>
        /// <param name="name">
        /// Initial value of the <see cref="Name"/> property.
        /// </param>
        /// <param name="description">
        /// Initial value of the <see cref="Description"/> property.
        /// </param>
        /// <param name="active">
        /// Initial value of the <see cref="Active"/> property.
        /// </param>
        public テナント(テナントId tenantId, string name, string description, bool active)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "TenentId is required.");
            AssertionConcern.AssertArgumentNotEmpty(name, "The tenant name is required.");
            AssertionConcern.AssertArgumentLength(name, 1, 100, "The name must be 100 characters or less.");
            AssertionConcern.AssertArgumentNotEmpty(description, "The tenant description is required.");
            AssertionConcern.AssertArgumentLength(description, 1, 100, "The name description be 100 characters or less.");

            this.TenantId = tenantId;
            this.Name = name;
            this.Description = description;
            this.Active = active;

            this.registrationInvitations = new HashSet<レジストレーション招待>();
        }
 public テナント管理者登録時(
     テナントId tenantId,
     string name,
     フルネーム administorName,
     Emailアドレス emailAddress,
     string username,
     string temporaryPassword)
 {
     this.AdministorName = administorName;
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.TemporaryPassword = temporaryPassword;
     this.TenantId = tenantId.Id;
 }
 public UserAssignedToRole(
     テナントId tenantId,
     string roleName,
     string username,
     string firstName,
     string lastName,
     string emailAddress)
 {
     this.EmailAddress = emailAddress;
     this.EventVersion = 1;
     this.FirstName = firstName;
     this.LastName = lastName;
     this.OccurredOn = DateTime.Now;
     this.RoleName = roleName;
     this.TenantId = tenantId;
     this.Username = username;
 }
        public ユーザー UserInRole(string tenantId, string userName, string roleName)
        {
            var id = new テナントId(tenantId);
            var user = this.userRepository.UserWithUsername(id, userName);
            if (user != null)
            {
                var role = this.roleRepository.RoleNamed(id, roleName);
                if (role != null)
                {
                    if (role.IsInRole(user, new グループメンバーサービス(this.userRepository, this.groupRepository)))
                    {
                        return user;
                    }
                }
            }

            return null;
        }
Exemplo n.º 23
0
        /// <summary>
        /// Authenticates a <see cref="ユーザー"/> given the
        /// <paramref name="tenantId"/>, <paramref name="username"/>,
        /// and <paramref name="password"/>.
        /// </summary>
        /// <param name="tenantId">
        /// A <see cref="テナントId"/> identifying a <see cref="テナント"/>
        /// with which a <see cref="ユーザー"/> is associated.
        /// </param>
        /// <param name="username">
        /// The username to authenticate.
        /// </param>
        /// <param name="password">
        /// The password to authenticate.
        /// </param>
        /// <returns>
        /// A <see cref="ユーザー記述子"/> of the authenticated user
        /// if the user can be authenticated; otherwise, null reference
        /// in the username and password do not match an enabled
        /// <see cref="ユーザー"/> for an active <see cref="テナント"/>.
        /// </returns>
        public ユーザー記述子 Authenticate(テナントId tenantId, string username, string password)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "TenantId must not be null.");
            AssertionConcern.AssertArgumentNotEmpty(username, "Username must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(password, "Password must be provided.");

            ユーザー記述子 userDescriptor = ユーザー記述子.NullDescriptorInstance();
            テナント tenant = this.tenantRepository.Get(tenantId);
            if ((tenant != null) && tenant.Active)
            {
                string encryptedPassword = this.encryptionService.EncryptedValue(password);
                ユーザー user = this.userRepository.UserFromAuthenticCredentials(tenantId, username, encryptedPassword);
                if ((user != null) && user.IsEnabled)
                {
                    userDescriptor = user.UserDescriptor;
                }
            }

            return userDescriptor;
        }
 public テナントアクティベート時(テナントId tenantId)
 {
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.TenantId = tenantId.Id;
 }
 public ユーザー記述子(テナントId tenantId, string username, string emailAddress)
 {
     this.EmailAddress = emailAddress;
     this.TenantId = tenantId;
     this.Username = username;
 }
 public レジストレーション招待(テナントId tenantId, string invitationId, string description)
     : this(tenantId, invitationId, description, DateTime.MinValue, DateTime.MinValue)
 {
 }