示例#1
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();
        }
示例#2
0
        public void UnassignGroup(グループ group)
        {
            AssertionConcern.AssertStateTrue(this.SupportsNesting, "This role does not support group nesting.");
            AssertionConcern.AssertArgumentNotNull(group, "Group must not be null.");
            AssertionConcern.AssertArgumentEquals(this.TenantId, group.TenantId, "Wrong tenant for this group.");

            this.internalGroup.RemoveGroup(group);

            DomainEventPublisher
                .Instance
                .Publish(new グループロールアサイン解除時(
                        this.TenantId,
                        this.Name,
                        group.Name));
        }
示例#3
0
        public void AddGroup(グループ group, グループメンバーサービス groupMemberService)
        {
            AssertionConcern.AssertArgumentNotNull(group, "Group must not be null.");
            AssertionConcern.AssertArgumentEquals(this.TenantId, group.TenantId, "Wrong tenant for this group.");
            AssertionConcern.AssertArgumentFalse(groupMemberService.IsMemberGroup(group, this.ToGroupMember()), "Group recurrsion.");

            if (this.GroupMembers.Add(group.ToGroupMember()) && (!this.IsInternalGroup))
            {
                DomainEventPublisher
                    .Instance
                    .Publish(new グループグループ追加時(
                            this.TenantId,
                            this.Name,
                            group.Name));
            }
        }
示例#4
0
        public void RemoveGroup(グループ group)
        {
            AssertionConcern.AssertArgumentNotNull(group, "Group must not be null.");
            AssertionConcern.AssertArgumentEquals(this.TenantId, group.TenantId, "Wrong tenant for this group.");

            // not a nested remove, only direct member
            if (this.GroupMembers.Remove(group.ToGroupMember()) && (!this.IsInternalGroup))
            {
                DomainEventPublisher
                    .Instance
                    .Publish(new グループグループ削除時(
                            this.TenantId,
                            this.Name,
                            group.Name));
            }
        }
示例#5
0
        public グループ ProvisionGroup(string name, string description)
        {
            AssertionConcern.AssertStateTrue(this.Active, "Tenant is not active.");

            グループ group = new グループ(this.TenantId, name, description);

            DomainEventPublisher.Instance.Publish(new グループプロビジョン時(this.TenantId, name));

            return group;
        }