Exemplo n.º 1
0
        public static Group ToGroupDomainModel(this GroupRoleApiModel groupRoleApiModel)
        {
            var group = new Group
            {
                Id     = string.IsNullOrEmpty(groupRoleApiModel.Id) ? groupRoleApiModel.GroupName : groupRoleApiModel.Id,
                Name   = groupRoleApiModel.GroupName,
                Source = groupRoleApiModel.GroupSource
            };

            return(group);
        }
Exemplo n.º 2
0
        public static GroupRoleApiModel ToGroupRoleApiModel(this Group group)
        {
            var groupRoleApiModel = new GroupRoleApiModel
            {
                Id          = group.Id,
                GroupName   = group.Name,
                Roles       = group.Roles?.Where(r => !r.IsDeleted).Select(r => r.ToRoleApiModel()),
                GroupSource = group.Source
            };

            return(groupRoleApiModel);
        }
Exemplo n.º 3
0
        public static Group ToGroupDomainModel(this GroupRoleApiModel groupRoleApiModel)
        {
            var group = new Group
            {
                Id          = groupRoleApiModel.Id ?? new Guid(),
                Name        = groupRoleApiModel.GroupName,
                DisplayName = groupRoleApiModel.DisplayName,
                Description = groupRoleApiModel.Description,
                Source      = groupRoleApiModel.GroupSource
            };

            return(group);
        }
Exemplo n.º 4
0
        public static GroupRoleApiModel ToGroupRoleApiModel(this Group group, GroupRoleRequest groupRoleRequest, Func <Role, string, string, bool> groupRoleFilter)
        {
            var groupRoleApiModel = new GroupRoleApiModel
            {
                Id        = group.Id,
                GroupName = group.Name,
                Roles     = group.Roles?
                            .Where(r => !r.IsDeleted &&
                                   groupRoleFilter(r, groupRoleRequest.Grain, groupRoleRequest.SecurableItem))
                            .Select(r => r.ToRoleApiModel()),
                GroupSource = group.Source
            };

            return(groupRoleApiModel);
        }
        public static Group ToGroupDomainModel(this GroupRoleApiModel groupRoleApiModel)
        {
            var group = new Group
            {
                Id               = groupRoleApiModel.Id ?? new Guid(),
                Name             = groupRoleApiModel.GroupName,
                IdentityProvider = groupRoleApiModel.IdentityProvider,
                DisplayName      = groupRoleApiModel.DisplayName,
                Description      = groupRoleApiModel.Description,
                Source           = groupRoleApiModel.GroupSource,
                TenantId         = groupRoleApiModel.TenantId
            };

            return(group);
        }
        public static GroupRoleApiModel ToGroupRoleApiModel(this Group group, bool isRequestedGroup = true)
        {
            var groupRoleApiModel = new GroupRoleApiModel
            {
                Id               = group.Id,
                GroupName        = group.Name,
                IdentityProvider = group.IdentityProvider,
                DisplayName      = string.IsNullOrWhiteSpace(group.DisplayName) ? group.Name : group.DisplayName,
                Description      = group.Description,
                Roles            = group.Roles?.Where(r => !r.IsDeleted).Select(r => r.ToRoleApiModel()),
                GroupSource      = group.Source,
                TenantId         = group.TenantId,
                Parents          = isRequestedGroup ? group.Parents.Select(p => p.ToGroupRoleApiModel(false)) : new List <GroupRoleApiModel>(),
                Children         = isRequestedGroup ? group.Children.Select(c => c.ToGroupRoleApiModel(false)) : new List <GroupRoleApiModel>()
            };

            return(groupRoleApiModel);
        }