Skip to content

Commit

Permalink
longshot
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Nov 22, 2024
1 parent d18bb76 commit 8026f0a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
15 changes: 14 additions & 1 deletion docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ type AttachmentUrl {
}

type AuthorizedParty {
subParties: [AuthorizedSubParty!]
party: String!
name: String!
partyType: String!
isDeleted: Boolean!
hasKeyRole: Boolean!
isCurrentEndUser: Boolean!
isMainAdministrator: Boolean!
isAccessManager: Boolean!
hasOnlyAccessToSubParties: Boolean!
}

type AuthorizedSubParty {
subParties: [AuthorizedSubParty!]
party: String!
name: String!
partyType: String!
Expand All @@ -75,7 +89,6 @@ type AuthorizedParty {
isMainAdministrator: Boolean!
isAccessManager: Boolean!
hasOnlyAccessToSubParties: Boolean!
subParties: [AuthorizedParty!]
}

type Content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public sealed class MappingProfile : Profile
public MappingProfile()
{
CreateMap<AuthorizedPartyDto, AuthorizedParty>();
CreateMap<AuthorizedPartyDto, AuthorizedSubParty>();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.Parties;

public sealed class AuthorizedParty
public class AuthorizedPartyBase
{
public string Party { get; init; } = null!;
public string Name { get; init; } = null!;
Expand All @@ -11,5 +11,12 @@ public sealed class AuthorizedParty
public bool IsMainAdministrator { get; init; }
public bool IsAccessManager { get; init; }
public bool HasOnlyAccessToSubParties { get; init; }
public List<AuthorizedParty>? SubParties { get; init; }
}

public class AuthorizedParty : AuthorizedPartyBase
{
public List<AuthorizedSubParty>? SubParties { get; init; }
}


public sealed class AuthorizedSubParty : AuthorizedParty;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Digdir.Domain.Dialogporten.Application.Externals;
using Digdir.Domain.Dialogporten.Application.Externals.AltinnAuthorization;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Digdir.Domain.Dialogporten.Domain.Parties;
using Digdir.Domain.Dialogporten.Domain.Parties.Abstractions;
using Microsoft.EntityFrameworkCore;

Expand Down Expand Up @@ -53,7 +54,23 @@ public async Task<DialogSearchAuthorizationResult> GetAuthorizedResourcesForSear

[SuppressMessage("Performance", "CA1822:Mark members as static")]
public async Task<AuthorizedPartiesResult> GetAuthorizedParties(IPartyIdentifier authenticatedParty, bool _ = false, CancellationToken __ = default)
=> await Task.FromResult(new AuthorizedPartiesResult { AuthorizedParties = [new() { Name = "Local Party", Party = authenticatedParty.FullId, IsCurrentEndUser = true }] });
=> await Task.FromResult(new AuthorizedPartiesResult
{
AuthorizedParties = [new()
{
Name = "Local Party",
Party = authenticatedParty.FullId,
IsCurrentEndUser = true,
SubParties = [
new()
{
Name = "Local Sub Party",
Party = NorwegianOrganizationIdentifier.PrefixWithSeparator + "123456789",
IsCurrentEndUser = true
}
]
}]
});

public Task<bool> HasListAuthorizationForDialog(DialogEntity dialog, CancellationToken cancellationToken) => Task.FromResult(true);
}

0 comments on commit 8026f0a

Please sign in to comment.