feat(role): リモートのアイコンとバナーの変更をロールで制限できるように (MisskeyIO#374)

This commit is contained in:
まっちゃとーにゅ 2024-01-23 20:37:14 +09:00 committed by GitHub
parent e0c0a2a0b0
commit 65382dc70b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 94 additions and 5 deletions

View file

@ -39,6 +39,8 @@ export type RolePolicies = {
canCreateContent: boolean;
canUpdateContent: boolean;
canDeleteContent: boolean;
canUpdateAvatar: boolean;
canUpdateBanner: boolean;
canInvite: boolean;
inviteLimit: number;
inviteLimitCycle: number;
@ -70,6 +72,8 @@ export const DEFAULT_POLICIES: RolePolicies = {
canCreateContent: true,
canUpdateContent: true,
canDeleteContent: true,
canUpdateAvatar: true,
canUpdateBanner: true,
canInvite: false,
inviteLimit: 0,
inviteLimitCycle: 60 * 24 * 7,
@ -337,6 +341,8 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
canCreateContent: calc('canCreateContent', vs => vs.some(v => v === true)),
canUpdateContent: calc('canUpdateContent', vs => vs.some(v => v === true)),
canDeleteContent: calc('canDeleteContent', vs => vs.some(v => v === true)),
canUpdateAvatar: calc('canUpdateAvatar', vs => vs.some(v => v === true)),
canUpdateBanner: calc('canUpdateBanner', vs => vs.some(v => v === true)),
canInvite: calc('canInvite', vs => vs.some(v => v === true)),
inviteLimit: calc('inviteLimit', vs => Math.max(...vs)),
inviteLimitCycle: calc('inviteLimitCycle', vs => Math.max(...vs)),