🐛 Trying to fix permission that inherits from groups.
This commit is contained in:
parent
9e7ba820c4
commit
185ab13ec9
@ -19,7 +19,7 @@ public class RealtimeCallController(IConfiguration configuration, AppDatabase db
|
||||
|
||||
[HttpGet("{roomId:guid}/join")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> JoinCall(Guid roomId)
|
||||
public async Task<ActionResult<JoinCallResponse>> JoinCall(Guid roomId)
|
||||
{
|
||||
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class PermissionService(
|
||||
public async Task<T?> GetPermissionAsync<T>(string actor, string area, string key)
|
||||
{
|
||||
var cacheKey = _GetPermissionCacheKey(actor, area, key);
|
||||
|
||||
|
||||
var cachedValue = await cache.GetAsync<T>(cacheKey);
|
||||
if (cachedValue != null)
|
||||
{
|
||||
@ -43,19 +43,19 @@ public class PermissionService(
|
||||
|
||||
var now = SystemClock.Instance.GetCurrentInstant();
|
||||
var groupsKey = _GetGroupsCacheKey(actor);
|
||||
|
||||
|
||||
var groupsId = await cache.GetAsync<List<Guid>>(groupsKey);
|
||||
if (groupsId == null)
|
||||
{
|
||||
groupsId = await db.PermissionGroupMembers
|
||||
.Where(n => n.Actor == actor)
|
||||
.Where(n => n.Actor == "user:" + actor)
|
||||
.Where(n => n.ExpiredAt == null || n.ExpiredAt < now)
|
||||
.Where(n => n.AffectedAt == null || n.AffectedAt >= now)
|
||||
.Select(e => e.GroupId)
|
||||
.ToListAsync();
|
||||
|
||||
await cache.SetWithGroupsAsync(groupsKey, groupsId,
|
||||
new[] { _GetPermissionGroupKey(actor) },
|
||||
|
||||
await cache.SetWithGroupsAsync(groupsKey, groupsId,
|
||||
[_GetPermissionGroupKey(actor)],
|
||||
CacheExpiration);
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ public class PermissionService(
|
||||
await cache.SetWithGroupsAsync(cacheKey, result,
|
||||
[_GetPermissionGroupKey(actor)],
|
||||
CacheExpiration);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@
|
||||
"SubjectPrefix": "Solar Network"
|
||||
},
|
||||
"RealtimeChat": {
|
||||
"Endpoint": "",
|
||||
"ApiKey": "",
|
||||
"ApiSecret": ""
|
||||
"Endpoint": "https://solar-network-im44o8gq.livekit.cloud",
|
||||
"ApiKey": "APIs6TiL8wj3A4j",
|
||||
"ApiSecret": "SffxRneIwTnlHPtEf3zicmmv3LUEl7xXael4PvWZrEhE"
|
||||
},
|
||||
"GeoIp": {
|
||||
"DatabasePath": "./Keys/GeoLite2-City.mmdb"
|
||||
|
Loading…
x
Reference in New Issue
Block a user