summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/RoleService.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-09 21:33:30 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-14 23:24:24 -0400
commit2e4ec0dd9e8f2d34592a4b8aa418c5bbe1ac5a67 (patch)
tree4c70257ab939c60735039fb3d42ef3bc3f7cdbbc /packages/backend/src/core/RoleService.ts
parentmerge: Allow port ranges in allowedPrivateIps (!1025) (diff)
downloadsharkey-2e4ec0dd9e8f2d34592a4b8aa418c5bbe1ac5a67.tar.gz
sharkey-2e4ec0dd9e8f2d34592a4b8aa418c5bbe1ac5a67.tar.bz2
sharkey-2e4ec0dd9e8f2d34592a4b8aa418c5bbe1ac5a67.zip
add role policy to allow note trending
Diffstat (limited to 'packages/backend/src/core/RoleService.ts')
-rw-r--r--packages/backend/src/core/RoleService.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts
index 039932b76d..c3b60837cf 100644
--- a/packages/backend/src/core/RoleService.ts
+++ b/packages/backend/src/core/RoleService.ts
@@ -69,6 +69,7 @@ export type RolePolicies = {
canImportMuting: boolean;
canImportUserLists: boolean;
chatAvailability: 'available' | 'readonly' | 'unavailable';
+ canTrend: boolean;
};
export const DEFAULT_POLICIES: RolePolicies = {
@@ -108,6 +109,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
canImportMuting: true,
canImportUserLists: true,
chatAvailability: 'available',
+ canTrend: true,
};
@Injectable()
@@ -149,6 +151,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
) {
this.rolesCache = new MemorySingleCache<MiRole[]>(1000 * 60 * 60); // 1h
this.roleAssignmentByUserIdCache = new MemoryKVCache<MiRoleAssignment[]>(1000 * 60 * 5); // 5m
+ // TODO additional cache for final calculation?
this.redisForSub.on('message', this.onMessage);
}
@@ -465,6 +468,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
canImportMuting: calc('canImportMuting', vs => vs.some(v => v === true)),
canImportUserLists: calc('canImportUserLists', vs => vs.some(v => v === true)),
chatAvailability: calc('chatAvailability', aggregateChatAvailability),
+ canTrend: calc('canTrend', vs => vs.some(v => v === true)),
};
}