:drunk: AI did something

This commit is contained in:
2025-07-08 00:08:35 +08:00
parent 0d47716713
commit 2c67472894
43 changed files with 221 additions and 97 deletions

View File

@@ -1,6 +1,9 @@
using MagicOnion;
using MagicOnion.Server;
using System.Text.Json;
using DysonNetwork.Shared.Cache;
using DysonNetwork.Shared.Models;
using DysonNetwork.Shared.Services;
using Microsoft.EntityFrameworkCore;
using NodaTime;
@@ -9,7 +12,7 @@ namespace DysonNetwork.Pass.Permission;
public class PermissionService(
AppDatabase db,
ICacheService cache
)
) : ServiceBase<IPermissionService>, IPermissionService
{
private static readonly TimeSpan CacheExpiration = TimeSpan.FromMinutes(1);
@@ -195,4 +198,11 @@ public class PermissionService(
Value = _SerializePermissionValue(value),
};
}
public async UnaryResult<bool> CheckPermission(string scope, string permission)
{
// Assuming the actor is always "user:current" for client-side checks
// You might need to adjust this based on how your client identifies itself
return await HasPermissionAsync("user:current", scope, permission);
}
}