Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Turnierplan.App/Client/src/app/i18n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,12 +927,15 @@ export const de = {
RoleName: {
Owner: 'Besitzer',
Contributor: 'Mitwirkender',
Reader: 'Leser'
Reader: 'Leser',
Reporter: 'Turnierdurchführung'
},
RoleDescription: {
Owner: 'Der Benutzer kann sämtliche Änderungen durchführen inkl. Änderungen an Zugriffsrechten.',
Contributor: 'Der Benutzer kann sämtliche Änderungen durchführen ausgenommen Änderungen an Zugriffsrechten.',
Reader: 'Der Benutzer kann sämtliche Informationen lesen aber keine Änderungen durchführen.'
Reader: 'Der Benutzer kann sämtliche Informationen lesen aber keine Änderungen durchführen.',
Reporter:
'Der Benutzer kann Spielergebnisse melden und löschen sowie Änderungen an der Startgebühr und Priorität der Mannschaften durchführen.'
},
PrincipalKind: {
ApiKey: 'API-Schlüssel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static async Task<IResult> Handle(
return Results.NotFound();
}

if (!accessValidator.IsActionAllowed(tournament, Actions.GenericWrite))
if (!accessValidator.IsActionAllowed(tournament, Actions.TournamentConduct))
{
return Results.Forbid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static async Task<IResult> Handle(
return Results.NotFound();
}

if (!accessValidator.IsActionAllowed(tournament, Actions.GenericWrite))
if (!accessValidator.IsActionAllowed(tournament, Actions.TournamentConduct))
{
return Results.Forbid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static async Task<IResult> Handle(
return Results.NotFound();
}

if (!accessValidator.IsActionAllowed(tournament, Actions.GenericWrite))
if (!accessValidator.IsActionAllowed(tournament, Actions.TournamentConduct))
{
return Results.Forbid();
}
Expand Down
5 changes: 5 additions & 0 deletions src/Turnierplan.App/Security/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ internal static class Actions
/// </summary>
public static readonly Action GenericRead = new(Role.Owner, Role.Contributor, Role.Reader);

/// <summary>
/// Any action that modifies a tournament in a way that is required during "playtime".
/// </summary>
public static readonly Action TournamentConduct = new(Role.Owner, Role.Contributor, Role.Reporter);

internal sealed class Action(params Role[] requiredRoles)
{
public bool IsAllowed(IEnumerable<Role> availableRoles)
Expand Down
12 changes: 11 additions & 1 deletion src/Turnierplan.Core/RoleAssignment/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ public enum Role
/// <summary>
/// This role grants the permission to view the target entity but not to make modifications.
/// </summary>
Reader = 1002
Reader = 1002,

#endregion

#region Tournament Roles

/// <summary>
/// This role grants the permission to perform all actions in a tournament which
/// are necessary while the tournament is played.
/// </summary>
Reporter = 2000

#endregion
}
Loading