Skip to content

Commit

Permalink
only allow admins to create orgs (follows what the frontend does)
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev authored and myieye committed Oct 29, 2024
1 parent 42c8b7f commit a84c509
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/LexBoxApi/Services/PermissionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,15 @@ public void AssertHasProjectRequestPermission()
if (!HasProjectRequestPermission()) throw new UnauthorizedAccessException();
}

public bool CanCreateOrg()
{
return User is {Role: UserRole.admin};
}

public void AssertCanCreateOrg()
{
//todo adjust permission
if (!HasProjectCreatePermission()) throw new UnauthorizedAccessException();
if (!CanCreateOrg()) throw new UnauthorizedAccessException();
}

public bool IsOrgMember(Guid orgId)
Expand Down

0 comments on commit a84c509

Please sign in to comment.