From 46f8a0435c378270598b703463d1c9b7f9d14ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 28 Jul 2023 04:21:59 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=AD=E3=83=BC=E3=83=AB=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=82=8B=E3=82=B3=E3=83=B3=E3=83=86=E3=83=B3=E3=83=84?= =?UTF-8?q?=E3=81=AE=E6=93=8D=E4=BD=9C=E3=81=AE=E5=88=B6=E9=99=90=20(#120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en-US.yml | 3 + locales/index.d.ts | 3 + locales/ja-JP.yml | 3 + packages/backend/src/core/RoleService.ts | 9 +++ .../src/core/entities/UserEntityService.ts | 10 ++-- .../backend/src/models/json-schema/user.ts | 4 ++ .../server/api/endpoints/admin/show-user.ts | 5 +- .../server/api/endpoints/antennas/create.ts | 1 + .../server/api/endpoints/antennas/delete.ts | 1 + .../server/api/endpoints/antennas/update.ts | 1 + .../server/api/endpoints/blocking/create.ts | 1 + .../server/api/endpoints/blocking/delete.ts | 1 + .../server/api/endpoints/channels/create.ts | 1 + .../server/api/endpoints/channels/favorite.ts | 1 + .../server/api/endpoints/channels/follow.ts | 1 + .../api/endpoints/channels/unfavorite.ts | 1 + .../server/api/endpoints/channels/unfollow.ts | 1 + .../server/api/endpoints/channels/update.ts | 1 + .../server/api/endpoints/clips/add-note.ts | 1 + .../src/server/api/endpoints/clips/create.ts | 1 + .../src/server/api/endpoints/clips/delete.ts | 1 + .../server/api/endpoints/clips/remove-note.ts | 1 + .../server/api/endpoints/clips/unfavorite.ts | 1 + .../src/server/api/endpoints/clips/update.ts | 1 + .../api/endpoints/drive/files/create.ts | 1 + .../api/endpoints/drive/files/delete.ts | 1 + .../api/endpoints/drive/files/update.ts | 1 + .../endpoints/drive/files/upload-from-url.ts | 1 + .../api/endpoints/drive/folders/create.ts | 1 + .../api/endpoints/drive/folders/delete.ts | 1 + .../api/endpoints/drive/folders/update.ts | 1 + .../src/server/api/endpoints/flash/create.ts | 1 + .../src/server/api/endpoints/flash/delete.ts | 1 + .../src/server/api/endpoints/flash/like.ts | 1 + .../src/server/api/endpoints/flash/unlike.ts | 1 + .../src/server/api/endpoints/flash/update.ts | 1 + .../api/endpoints/gallery/posts/create.ts | 1 + .../api/endpoints/gallery/posts/delete.ts | 1 + .../api/endpoints/gallery/posts/like.ts | 1 + .../api/endpoints/gallery/posts/unlike.ts | 1 + .../api/endpoints/gallery/posts/update.ts | 1 + .../server/api/endpoints/i/delete-account.ts | 1 + .../server/api/endpoints/i/import-antennas.ts | 2 + .../server/api/endpoints/i/import-blocking.ts | 2 + .../server/api/endpoints/i/import-muting.ts | 2 + .../api/endpoints/i/import-user-lists.ts | 3 + .../src/server/api/endpoints/i/move.ts | 3 + .../backend/src/server/api/endpoints/i/pin.ts | 2 + .../src/server/api/endpoints/i/unpin.ts | 1 + .../server/api/endpoints/i/update-email.ts | 5 +- .../src/server/api/endpoints/i/update.ts | 1 + .../server/api/endpoints/i/webhooks/create.ts | 1 + .../server/api/endpoints/i/webhooks/delete.ts | 1 + .../server/api/endpoints/i/webhooks/update.ts | 1 + .../src/server/api/endpoints/mute/create.ts | 2 + .../src/server/api/endpoints/mute/delete.ts | 1 + .../src/server/api/endpoints/notes/create.ts | 1 + .../src/server/api/endpoints/notes/delete.ts | 1 + .../api/endpoints/notes/favorites/create.ts | 2 + .../api/endpoints/notes/favorites/delete.ts | 1 + .../server/api/endpoints/notes/polls/vote.ts | 1 + .../api/endpoints/notes/reactions/create.ts | 1 + .../api/endpoints/notes/reactions/delete.ts | 1 + .../endpoints/notes/thread-muting/create.ts | 1 + .../endpoints/notes/thread-muting/delete.ts | 1 + .../server/api/endpoints/notes/unrenote.ts | 1 + .../src/server/api/endpoints/pages/create.ts | 1 + .../src/server/api/endpoints/pages/delete.ts | 1 + .../src/server/api/endpoints/pages/like.ts | 1 + .../src/server/api/endpoints/pages/unlike.ts | 1 + .../src/server/api/endpoints/pages/update.ts | 1 + .../api/endpoints/renote-mute/create.ts | 2 + .../api/endpoints/renote-mute/delete.ts | 1 + .../users/lists/create-from-public.ts | 3 + .../api/endpoints/users/lists/create.ts | 1 + .../api/endpoints/users/lists/delete.ts | 1 + .../api/endpoints/users/lists/favorite.ts | 2 + .../server/api/endpoints/users/lists/pull.ts | 1 + .../server/api/endpoints/users/lists/push.ts | 1 + .../api/endpoints/users/lists/unfavorite.ts | 2 + .../api/endpoints/users/lists/update.ts | 1 + .../server/api/endpoints/users/update-memo.ts | 1 + packages/backend/test/e2e/users.ts | 2 + packages/frontend/.storybook/fakes.ts | 1 + .../src/components/MkUserCardMini.vue | 2 +- packages/frontend/src/const.ts | 3 + .../frontend/src/pages/admin/roles.editor.vue | 60 +++++++++++++++++++ packages/frontend/src/pages/admin/roles.vue | 26 +++++++- packages/frontend/src/pages/user-info.vue | 10 +++- packages/misskey-js/etc/misskey-js.api.md | 1 + packages/misskey-js/src/entities.ts | 3 +- 91 files changed, 228 insertions(+), 11 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 9cb00c8ee9..03b37f1356 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1404,6 +1404,9 @@ _role: gtlAvailable: "Can view the global timeline" ltlAvailable: "Can view the local timeline" canPublicNote: "Can send public notes" + canCreateContent: "Can create contents" + canUpdateContent: "Can edit contents" + canDeleteContent: "Can delete contents" canInvite: "Can create instance invite codes" inviteLimit: "Invite limit" inviteLimitCycle: "Invite limit cooldown" diff --git a/locales/index.d.ts b/locales/index.d.ts index e101195ae3..c4ef573a80 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1490,6 +1490,9 @@ export interface Locale { "gtlAvailable": string; "ltlAvailable": string; "canPublicNote": string; + "canCreateContent": string; + "canUpdateContent": string; + "canDeleteContent": string; "canInvite": string; "inviteLimit": string; "inviteLimitCycle": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d88a8c025c..07ba3cecc2 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1412,6 +1412,9 @@ _role: gtlAvailable: "グローバルタイムラインの閲覧" ltlAvailable: "ローカルタイムラインの閲覧" canPublicNote: "パブリック投稿の許可" + canCreateContent: "コンテンツの作成" + canUpdateContent: "コンテンツの編集" + canDeleteContent: "コンテンツの削除" canInvite: "サーバー招待コードの発行" inviteLimit: "招待コードの作成可能数" inviteLimitCycle: "招待コードの発行間隔" diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index d065b460c6..58979f7328 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -20,6 +20,9 @@ export type RolePolicies = { gtlAvailable: boolean; ltlAvailable: boolean; canPublicNote: boolean; + canCreateContent: boolean; + canUpdateContent: boolean; + canDeleteContent: boolean; canInvite: boolean; inviteLimit: number; inviteLimitCycle: number; @@ -44,6 +47,9 @@ export const DEFAULT_POLICIES: RolePolicies = { gtlAvailable: true, ltlAvailable: true, canPublicNote: true, + canCreateContent: true, + canUpdateContent: true, + canDeleteContent: true, canInvite: false, inviteLimit: 0, inviteLimitCycle: 60 * 24 * 7, @@ -287,6 +293,9 @@ export class RoleService implements OnApplicationShutdown { gtlAvailable: calc('gtlAvailable', vs => vs.some(v => v === true)), ltlAvailable: calc('ltlAvailable', vs => vs.some(v => v === true)), canPublicNote: calc('canPublicNote', vs => vs.some(v => v === true)), + 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)), canInvite: calc('canInvite', vs => vs.some(v => v === true)), inviteLimit: calc('inviteLimit', vs => Math.max(...vs)), inviteLimitCycle: calc('inviteLimitCycle', vs => Math.max(...vs)), diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 3fd1768426..5987eeb81f 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -351,8 +351,9 @@ export class UserEntityService implements OnModuleInit { (profile.ffVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount : null; - const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null; - const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null; + const isModerator = isMe && opts.detail ? await this.roleService.isModerator(user) : null; + const isAdmin = isMe && opts.detail ? await this.roleService.isAdministrator(user) : null; + const policies = opts.detail ? await this.roleService.getUserPolicies(user.id) : null; const falsy = opts.detail ? false : undefined; @@ -396,7 +397,8 @@ export class UserEntityService implements OnModuleInit { bannerUrl: user.bannerUrl, bannerBlurhash: user.bannerBlurhash, isLocked: user.isLocked, - isSilenced: this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote), + isSilenced: !policies?.canPublicNote, + isLimited: !(policies?.canCreateContent && policies.canUpdateContent && policies.canDeleteContent), isSuspended: user.isSuspended ?? falsy, description: profile!.description, location: profile!.location, @@ -473,7 +475,7 @@ export class UserEntityService implements OnModuleInit { emailNotificationTypes: profile!.emailNotificationTypes, achievements: profile!.achievements, loggedInDays: profile!.loggedInDates.length, - policies: this.roleService.getUserPolicies(user.id), + policies: policies, } : {}), ...(opts.includeSecrets ? { diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index f9a20ac398..311e2db9c0 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -121,6 +121,10 @@ export const packedUserDetailedNotMeOnlySchema = { type: 'boolean', nullable: false, optional: false, }, + isLimited: { + type: 'boolean', + nullable: false, optional: false, + }, isSuspended: { type: 'boolean', nullable: false, optional: false, diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts index 6f805b6b4e..81f3583174 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts @@ -51,8 +51,10 @@ export default class extends Endpoint { throw new Error('user not found'); } + const policies = await this.roleService.getUserPolicies(user.id); const isModerator = await this.roleService.isModerator(user); - const isSilenced = !(await this.roleService.getUserPolicies(user.id)).canPublicNote; + const isLimited = !(policies.canCreateContent && policies.canUpdateContent && policies.canDeleteContent); + const isSilenced = !policies.canPublicNote; const _me = await this.usersRepository.findOneByOrFail({ id: me.id }); if (!await this.roleService.isAdministrator(_me) && await this.roleService.isAdministrator(user)) { @@ -80,6 +82,7 @@ export default class extends Endpoint { mutingNotificationTypes: profile.mutingNotificationTypes, isModerator: isModerator, isSilenced: isSilenced, + isLimited: isLimited, isSuspended: user.isSuspended, lastActiveDate: user.lastActiveDate, moderationNote: profile.moderationNote ?? '', diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 5754a9f12a..6908af7e6c 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['antennas'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index 5da7a2cb66..82f6ffbc0f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['antennas'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index 55218b644b..a732cc9622 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['antennas'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index 4ad40c8f1c..c55c305314 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -17,6 +17,7 @@ export const meta = { }, requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:blocks', diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index ad3d9f22b3..df29b123e7 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -17,6 +17,7 @@ export const meta = { }, requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:blocks', diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 69e2f2504c..a7caef07fa 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/channels/favorite.ts b/packages/backend/src/server/api/endpoints/channels/favorite.ts index c8544273a1..0e359ee2c9 100644 --- a/packages/backend/src/server/api/endpoints/channels/favorite.ts +++ b/packages/backend/src/server/api/endpoints/channels/favorite.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index f3ca66cfd2..ba19ca38da 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/channels/unfavorite.ts b/packages/backend/src/server/api/endpoints/channels/unfavorite.ts index 67fb1ea03e..9516043b94 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfavorite.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfavorite.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index f46ff9f286..d86914b4d0 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index 30d7f8b244..965c74c979 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['channels'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:channels', diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index 2837f2cf81..9ef2a8266a 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -14,6 +14,7 @@ export const meta = { requireCredential: true, prohibitMoved: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index 5395a5c373..d0dc9baf75 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['clips'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index 077a9ec40f..210bba0d58 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['clips'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/clips/remove-note.ts b/packages/backend/src/server/api/endpoints/clips/remove-note.ts index d0ef795819..6eeef06ccf 100644 --- a/packages/backend/src/server/api/endpoints/clips/remove-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/remove-note.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['account', 'notes', 'clips'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/clips/unfavorite.ts b/packages/backend/src/server/api/endpoints/clips/unfavorite.ts index 3da252a226..fe9c965a03 100644 --- a/packages/backend/src/server/api/endpoints/clips/unfavorite.ts +++ b/packages/backend/src/server/api/endpoints/clips/unfavorite.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['clip'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index 70f1959353..8c8ca59886 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['clips'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index a1c1f9325e..72900358ef 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -14,6 +14,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 2ced97ee02..ca7f22d65d 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:drive', diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index c43f812e2f..92a09e6049 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:drive', diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index c835587c4a..0c3b743254 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -18,6 +18,7 @@ export const meta = { description: 'Request the server to download a new drive file from the specified URL.', requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index 39c9c6bc58..3b1e2265c6 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canCreateContent', kind: 'write:drive', diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index d921bc1b17..6970c0572b 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:drive', diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index ff0a78b929..05cc1ff5a4 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['drive'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:drive', diff --git a/packages/backend/src/server/api/endpoints/flash/create.ts b/packages/backend/src/server/api/endpoints/flash/create.ts index 3172bdbfda..fc556ad2b7 100644 --- a/packages/backend/src/server/api/endpoints/flash/create.ts +++ b/packages/backend/src/server/api/endpoints/flash/create.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['flash'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/flash/delete.ts b/packages/backend/src/server/api/endpoints/flash/delete.ts index e94ede9f68..11fc894bde 100644 --- a/packages/backend/src/server/api/endpoints/flash/delete.ts +++ b/packages/backend/src/server/api/endpoints/flash/delete.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['flashs'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:flash', diff --git a/packages/backend/src/server/api/endpoints/flash/like.ts b/packages/backend/src/server/api/endpoints/flash/like.ts index 57245f9f41..c66ccbb8d7 100644 --- a/packages/backend/src/server/api/endpoints/flash/like.ts +++ b/packages/backend/src/server/api/endpoints/flash/like.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['flash'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/flash/unlike.ts b/packages/backend/src/server/api/endpoints/flash/unlike.ts index 696512b06c..1a54212d78 100644 --- a/packages/backend/src/server/api/endpoints/flash/unlike.ts +++ b/packages/backend/src/server/api/endpoints/flash/unlike.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['flash'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/flash/update.ts b/packages/backend/src/server/api/endpoints/flash/update.ts index 78dfd4a06a..b4c846ae71 100644 --- a/packages/backend/src/server/api/endpoints/flash/update.ts +++ b/packages/backend/src/server/api/endpoints/flash/update.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['flash'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index ca6bfa7e0f..2cfed8cacc 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['gallery'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 6cdcc17b39..8294aa57cf 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['gallery'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:gallery', diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index c0bb55f640..ac1e42995a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['gallery'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index 513089217d..887dc64124 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['gallery'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index a2a10d8400..5eb609ef76 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['gallery'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 77a03d9811..ffa1fa472b 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -7,6 +7,7 @@ import { DI } from '@/di-symbols.js'; export const meta = { requireCredential: true, + requireRolePolicy: 'canDeleteContent', secure: true, } as const; diff --git a/packages/backend/src/server/api/endpoints/i/import-antennas.ts b/packages/backend/src/server/api/endpoints/i/import-antennas.ts index 8582e98f76..376b0be9a9 100644 --- a/packages/backend/src/server/api/endpoints/i/import-antennas.ts +++ b/packages/backend/src/server/api/endpoints/i/import-antennas.ts @@ -11,6 +11,8 @@ import { ApiError } from '../../error.js'; export const meta = { secure: true, requireCredential: true, + requireRolePolicy: 'canCreateContent', + prohibitMoved: true, limit: { diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index 32c16300fb..dda915696e 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -10,6 +10,8 @@ import { ApiError } from '../../error.js'; export const meta = { secure: true, requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, limit: { diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index 34f2627563..982f258410 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -10,6 +10,8 @@ import { ApiError } from '../../error.js'; export const meta = { secure: true, requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, limit: { diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index 1b3cb5359d..48c9947622 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -10,7 +10,10 @@ import { ApiError } from '../../error.js'; export const meta = { secure: true, requireCredential: true, + requireRolePolicy: 'canCreateContent', + prohibitMoved: true, + limit: { duration: ms('1hour'), max: 1, diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index 261dd527c0..b7fc31791f 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -23,7 +23,10 @@ export const meta = { secure: true, requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, + limit: { duration: ms('1day'), max: 5, diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index 2293500945..21fc9674c5 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -8,6 +8,8 @@ export const meta = { tags: ['account', 'notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index db239dc284..72af6b7635 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['account', 'notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index 58e056bd37..64b026650c 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -12,10 +12,11 @@ import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js'; import { ApiError } from '../../error.js'; export const meta = { - requireCredential: true, - secure: true, + requireCredential: true, + requireRolePolicy: 'canUpdateContent', + limit: { duration: ms('1hour'), max: 3, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 8f5e6177c2..4eaad78445 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -30,6 +30,7 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts index 51fcce6cf0..642e497666 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['webhooks'], requireCredential: true, + requireRolePolicy: 'canCreateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts index 7bdad136aa..7cf8394e95 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['webhooks'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts index 8ec308eda7..69e2e4220b 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['webhooks'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index ef53f9ef41..db3a64af8e 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -11,6 +11,8 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, kind: 'write:mutes', diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 90b74590be..3bf928a1f5 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:mutes', diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 739316997a..36c9ee4acb 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -17,6 +17,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 16c4c01387..b802975017 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:notes', diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 9299d66039..7db933322f 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -12,6 +12,8 @@ export const meta = { tags: ['notes', 'favorites'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, kind: 'write:favorites', diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index bb3a7c501a..5b1c2edf1c 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['notes', 'favorites'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:favorites', diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 3a33b037f8..c789313abb 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -16,6 +16,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index 97cb026779..4de379d30f 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['reactions', 'notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 207f0b4cf2..1420f567cf 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['reactions', 'notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:reactions', diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index abea069da8..17fcdc3be4 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index 30016d48bc..2337289dca 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index e9581beedc..19e4bacb5e 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['notes'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:notes', diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index e08ab399f8..00a07f8fa8 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['pages'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/pages/delete.ts b/packages/backend/src/server/api/endpoints/pages/delete.ts index e64733131c..c25c28806e 100644 --- a/packages/backend/src/server/api/endpoints/pages/delete.ts +++ b/packages/backend/src/server/api/endpoints/pages/delete.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['pages'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:pages', diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index bc66488103..cce9ce7bd5 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['pages'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index f0c0198460..0fc68ace2e 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['pages'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 751274067e..39757ff74b 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['pages'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/renote-mute/create.ts b/packages/backend/src/server/api/endpoints/renote-mute/create.ts index beb5850d78..1404a64cc4 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/create.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/create.ts @@ -13,6 +13,8 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', + prohibitMoved: true, kind: 'write:mutes', diff --git a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts index 70901a1406..aac8176365 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:mutes', diff --git a/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts b/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts index beb0ba85ff..70081d51e7 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts @@ -12,7 +12,10 @@ import { UserListService } from '@/core/UserListService.js'; export const meta = { requireCredential: true, + requireRolePolicy: 'canCreateContent', + prohibitMoved: true, + res: { type: 'object', optional: false, nullable: false, diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index 7510889526..0684d34de4 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -12,6 +12,7 @@ export const meta = { tags: ['lists'], requireCredential: true, + requireRolePolicy: 'canCreateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 237cb075ab..9ef9941ca6 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -8,6 +8,7 @@ export const meta = { tags: ['lists'], requireCredential: true, + requireRolePolicy: 'canDeleteContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/users/lists/favorite.ts b/packages/backend/src/server/api/endpoints/users/lists/favorite.ts index 2c09a47fef..e75ac34be1 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/favorite.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/favorite.ts @@ -7,6 +7,8 @@ import { DI } from '@/di-symbols.js'; export const meta = { requireCredential: true, + requireRolePolicy: 'canUpdateContent', + errors: { noSuchList: { message: 'No such user list.', diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index d50b70efc2..40ffec4732 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['lists', 'users'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 6e1f6b2c62..7a52445e80 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -11,6 +11,7 @@ export const meta = { tags: ['lists', 'users'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', prohibitMoved: true, diff --git a/packages/backend/src/server/api/endpoints/users/lists/unfavorite.ts b/packages/backend/src/server/api/endpoints/users/lists/unfavorite.ts index a7c3b58947..643841e1dc 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/unfavorite.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/unfavorite.ts @@ -6,6 +6,8 @@ import { DI } from '@/di-symbols.js'; export const meta = { requireCredential: true, + requireRolePolicy: 'canUpdateContent', + errors: { noSuchList: { message: 'No such user list.', diff --git a/packages/backend/src/server/api/endpoints/users/lists/update.ts b/packages/backend/src/server/api/endpoints/users/lists/update.ts index b0a95a2f28..4bcc816cf1 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/update.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/update.ts @@ -9,6 +9,7 @@ export const meta = { tags: ['lists'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/src/server/api/endpoints/users/update-memo.ts b/packages/backend/src/server/api/endpoints/users/update-memo.ts index ca7756ef75..53340a3f93 100644 --- a/packages/backend/src/server/api/endpoints/users/update-memo.ts +++ b/packages/backend/src/server/api/endpoints/users/update-memo.ts @@ -10,6 +10,7 @@ export const meta = { tags: ['account'], requireCredential: true, + requireRolePolicy: 'canUpdateContent', kind: 'write:account', diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 64efaa57cc..622d25a802 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -91,6 +91,7 @@ describe('ユーザー', () => { bannerBlurhash: user.bannerBlurhash, isLocked: user.isLocked, isSilenced: user.isSilenced, + isLimited: user.isLimited, isSuspended: user.isSuspended, description: user.description, location: user.location, @@ -356,6 +357,7 @@ describe('ユーザー', () => { assert.strictEqual(response.bannerBlurhash, null); assert.strictEqual(response.isLocked, false); assert.strictEqual(response.isSilenced, false); + assert.strictEqual(response.isLimited, false); assert.strictEqual(response.isSuspended, false); assert.strictEqual(response.description, null); assert.strictEqual(response.location, null); diff --git a/packages/frontend/.storybook/fakes.ts b/packages/frontend/.storybook/fakes.ts index a4289cff7d..7a8ab8044e 100644 --- a/packages/frontend/.storybook/fakes.ts +++ b/packages/frontend/.storybook/fakes.ts @@ -99,6 +99,7 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi isModerator: false, isMuted: false, isSilenced: false, + isLimited: false, isSuspended: false, lang: 'en', location: 'Fediverse', diff --git a/packages/frontend/src/components/MkUserCardMini.vue b/packages/frontend/src/components/MkUserCardMini.vue index 457504e6ca..79a96043ea 100644 --- a/packages/frontend/src/components/MkUserCardMini.vue +++ b/packages/frontend/src/components/MkUserCardMini.vue @@ -1,5 +1,5 @@