diff --git a/src/Tgstation.Server.Host/GraphQL/Types/User.cs b/src/Tgstation.Server.Host/GraphQL/Types/User.cs index 2a8e4c2832..bb4015733f 100644 --- a/src/Tgstation.Server.Host/GraphQL/Types/User.cs +++ b/src/Tgstation.Server.Host/GraphQL/Types/User.cs @@ -60,17 +60,16 @@ namespace Tgstation.Server.Host.GraphQL.Types /// public required UserGroup? Group { get; set; } + /// + /// The associated with the . + /// + public required PermissionSet EffectivePermissionSet { get; set; } + /// /// The for the user if the user does not belong to a . /// public required PermissionSet? OwnedPermissionSet { get; set; } - /// - /// The of the . - /// - [IsProjected(true)] - public required long? GroupId { get; init; } - /// /// The of the . /// @@ -169,34 +168,5 @@ namespace Tgstation.Server.Host.GraphQL.Types return userAuthority.Invoke( authority => authority.OidcConnections(Id, cancellationToken)); } - - /// - /// The associated with the . - /// - /// The for the . - /// The for the operation. - /// A resulting in the associated with the . - public ValueTask EffectivePermissionSet( - [Service] IGraphQLAuthorityInvoker permissionSetAuthority, - CancellationToken cancellationToken) - { - ArgumentNullException.ThrowIfNull(permissionSetAuthority); - - long lookupId; - PermissionSetLookupType lookupType; - if (GroupId.HasValue) - { - lookupId = GroupId.Value; - lookupType = PermissionSetLookupType.GroupId; - } - else - { - lookupId = Id; - lookupType = PermissionSetLookupType.UserId; - } - - return permissionSetAuthority.InvokeTransformable( - authority => authority.GetId(lookupId, lookupType, cancellationToken)); - } } } diff --git a/src/Tgstation.Server.Host/Models/Transformers/UserGraphQLTransformer.cs b/src/Tgstation.Server.Host/Models/Transformers/UserGraphQLTransformer.cs index 2a3656cc98..7682f286ef 100644 --- a/src/Tgstation.Server.Host/Models/Transformers/UserGraphQLTransformer.cs +++ b/src/Tgstation.Server.Host/Models/Transformers/UserGraphQLTransformer.cs @@ -19,17 +19,21 @@ namespace Tgstation.Server.Host.Models.Transformers GraphQL.Types.PermissionSet, UserGroupGraphQLTransformer, PermissionSetGraphQLTransformer>( - (model, group, permissionSet) => new GraphQL.Types.User + (model, group, ownedPermissionSet) => new GraphQL.Types.User { CreatedAt = model.CreatedAt ?? NotNullFallback(), CanonicalName = model.CanonicalName ?? NotNullFallback(), CreatedById = model.CreatedById, Enabled = model.Enabled ?? NotNullFallback(), - GroupId = model.GroupId, Id = model.Id!.Value, Name = model.Name ?? NotNullFallback(), SystemIdentifier = model.SystemIdentifier, - OwnedPermissionSet = permissionSet, + OwnedPermissionSet = ownedPermissionSet, + EffectivePermissionSet = ownedPermissionSet != null + ? ownedPermissionSet + : group != null + ? group.PermissionSet + : NotNullFallback(), Group = group, }, model => model.Group,