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 9cb00c8ee..03b37f135 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 e101195ae..c4ef573a8 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 d88a8c025..07ba3cecc 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 d065b460c..58979f732 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 3fd176842..5987eeb81 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 f9a20ac39..311e2db9c 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 6f805b6b4..81f358317 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 5754a9f12..6908af7e6 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 5da7a2cb6..82f6ffbc0 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 55218b644..a732cc962 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 4ad40c8f1..c55c30531 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 ad3d9f22b..df29b123e 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 69e2f2504..a7caef07f 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 c8544273a..0e359ee2c 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 f3ca66cfd..ba19ca38d 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 67fb1ea03..9516043b9 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 f46ff9f28..d86914b4d 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 30d7f8b24..965c74c97 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 2837f2cf8..9ef2a8266 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 5395a5c37..d0dc9baf7 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 077a9ec40..210bba0d5 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 d0ef79581..6eeef06cc 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 3da252a22..fe9c965a0 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 70f195935..8c8ca5988 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 a1c1f9325..72900358e 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 2ced97ee0..ca7f22d65 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 c43f812e2..92a09e604 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 c835587c4..0c3b74325 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 39c9c6bc5..3b1e2265c 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 d921bc1b1..6970c0572 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 ff0a78b92..05cc1ff5a 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 3172bdbfd..fc556ad2b 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 e94ede9f6..11fc894bd 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 57245f9f4..c66ccbb8d 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 696512b06..1a54212d7 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 78dfd4a06..b4c846ae7 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 ca6bfa7e0..2cfed8cac 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 6cdcc17b3..8294aa57c 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 c0bb55f64..ac1e42995 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 513089217..887dc6412 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 a2a10d840..5eb609ef7 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 77a03d981..ffa1fa472 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 8582e98f7..376b0be9a 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 32c16300f..dda915696 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 34f262756..982f25841 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 1b3cb5359..48c994762 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 261dd527c..b7fc31791 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 229350094..21fc9674c 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 db239dc28..72af6b763 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 58e056bd3..64b026650 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 8f5e6177c..4eaad7844 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 51fcce6cf..642e49766 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 7bdad136a..7cf8394e9 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 8ec308eda..69e2e4220 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 ef53f9ef4..db3a64af8 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 90b74590b..3bf928a1f 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 739316997..36c9ee4ac 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 16c4c0138..b80297501 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 9299d6603..7db933322 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 bb3a7c501..5b1c2edf1 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 3a33b037f..c789313ab 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 97cb02677..4de379d30 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 207f0b4cf..1420f567c 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 abea069da..17fcdc3be 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 30016d48b..2337289dc 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 e9581beed..19e4bacb5 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 e08ab399f..00a07f8fa 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 e64733131..c25c28806 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 bc6648810..cce9ce7bd 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 f0c019846..0fc68ace2 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 751274067..39757ff74 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 beb5850d7..1404a64cc 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 70901a140..aac817636 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 beb0ba85f..70081d51e 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 751088952..0684d34de 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 237cb075a..9ef9941ca 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 2c09a47fe..e75ac34be 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 d50b70efc..40ffec473 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 6e1f6b2c6..7a52445e8 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 a7c3b5894..643841e1d 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 b0a95a2f2..4bcc816cf 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 ca7756ef7..53340a3f9 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 64efaa57c..622d25a80 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 a4289cff7..7a8ab8044 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 457504e6c..79a96043e 100644 --- a/packages/frontend/src/components/MkUserCardMini.vue +++ b/packages/frontend/src/components/MkUserCardMini.vue @@ -1,5 +1,5 @@