Added checks for existing permissions when creating, updating and deleting permissions.

This commit is contained in:
Tom
2025-03-29 20:11:12 +00:00
parent 07cb396dd7
commit c80f1f2aa0
3 changed files with 12 additions and 1 deletions

View File

@@ -31,6 +31,11 @@ namespace HermesSocketServer.Requests
Allow = allow,
};
if (!channel.GroupPermissions.Get().Values.Any(p => p.GroupId == groupId && p.Path == path))
{
return Task.FromResult(RequestResult.Failed("Permission does not exist."));
}
bool result = channel.GroupPermissions.Modify(id.ToString(), permission);
if (result)
{