diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b171f4ae..2702189568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Enhance: Unicode 15.1 および 16.0 に収録されている絵文字に対応 - Enhance: acctに `.` が入っているユーザーのメンションに対応 - Fix: Unicode絵文字に隣接する異体字セレクタ(`U+FE0F`)が絵文字として認識される問題を修正 +- Enhance: ユーザー検索をロールポリシーで制限できるように ### Client - Feat: AiScriptが1.0に更新されました diff --git a/locales/index.d.ts b/locales/index.d.ts index b2906cf48e..028db4043f 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -4386,6 +4386,10 @@ export interface Locale extends ILocale { * ノート検索は利用できません。 */ "notesSearchNotAvailable": string; + /** + * ユーザー検索は利用できません。 + */ + "usersSearchNotAvailable": string; /** * ライセンス */ @@ -7799,6 +7803,10 @@ export interface Locale extends ILocale { * ノート検索の利用 */ "canSearchNotes": string; + /** + * ユーザー検索の利用 + */ + "canSearchUsers": string; /** * 翻訳機能の利用 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d45aa7bb86..7aa88f399d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1092,6 +1092,7 @@ prohibitedWordsDescription2: "スペースで区切るとAND指定になり、 hiddenTags: "非表示ハッシュタグ" hiddenTagsDescription: "設定したタグをトレンドに表示させないようにします。改行で区切って複数設定できます。" notesSearchNotAvailable: "ノート検索は利用できません。" +usersSearchNotAvailable: "ユーザー検索は利用できません。" license: "ライセンス" unfavoriteConfirm: "お気に入り解除しますか?" myClips: "自分のクリップ" @@ -2020,6 +2021,7 @@ _role: descriptionOfRateLimitFactor: "小さいほど制限が緩和され、大きいほど制限が強化されます。" canHideAds: "広告の非表示" canSearchNotes: "ノート検索の利用" + canSearchUsers: "ユーザー検索の利用" canUseTranslator: "翻訳機能の利用" avatarDecorationLimit: "アイコンデコレーションの最大取付個数" canImportAntennas: "アンテナのインポートを許可" diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index cddfc0094e..3df7ee69ee 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -43,6 +43,7 @@ export type RolePolicies = { canManageCustomEmojis: boolean; canManageAvatarDecorations: boolean; canSearchNotes: boolean; + canSearchUsers: boolean; canUseTranslator: boolean; canHideAds: boolean; driveCapacityMb: number; @@ -82,6 +83,7 @@ export const DEFAULT_POLICIES: RolePolicies = { canManageCustomEmojis: false, canManageAvatarDecorations: false, canSearchNotes: false, + canSearchUsers: true, canUseTranslator: true, canHideAds: false, driveCapacityMb: 100, @@ -402,6 +404,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit { canManageCustomEmojis: calc('canManageCustomEmojis', vs => vs.some(v => v === true)), canManageAvatarDecorations: calc('canManageAvatarDecorations', vs => vs.some(v => v === true)), canSearchNotes: calc('canSearchNotes', vs => vs.some(v => v === true)), + canSearchUsers: calc('canSearchUsers', vs => vs.some(v => v === true)), canUseTranslator: calc('canUseTranslator', vs => vs.some(v => v === true)), canHideAds: calc('canHideAds', vs => vs.some(v => v === true)), driveCapacityMb: calc('driveCapacityMb', vs => Math.max(...vs)), diff --git a/packages/backend/src/models/json-schema/role.ts b/packages/backend/src/models/json-schema/role.ts index c9cdbd5d89..0b9234cb81 100644 --- a/packages/backend/src/models/json-schema/role.ts +++ b/packages/backend/src/models/json-schema/role.ts @@ -212,6 +212,10 @@ export const packedRolePoliciesSchema = { type: 'boolean', optional: false, nullable: false, }, + canSearchUsers: { + type: 'boolean', + optional: false, nullable: false, + }, canUseTranslator: { type: 'boolean', optional: false, nullable: false, diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 5d36847e03..c422286152 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -13,6 +13,7 @@ export const meta = { tags: ['users'], requireCredential: false, + requiredRolePolicy: 'canSearchUsers', description: 'Search for users.', diff --git a/packages/frontend/src/pages/admin/roles.editor.vue b/packages/frontend/src/pages/admin/roles.editor.vue index c172e22688..bb96a1cde1 100644 --- a/packages/frontend/src/pages/admin/roles.editor.vue +++ b/packages/frontend/src/pages/admin/roles.editor.vue @@ -346,6 +346,26 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.canSearchUsers }} + + {{ i18n.ts._role.useBaseValue }} + {{ role.policies.canSearchUsers.value ? i18n.ts.yes : i18n.ts.no }} + + + + + {{ i18n.ts._role.useBaseValue }} + + + {{ i18n.ts.enable }} + + + {{ i18n.ts._role.priority }} + + + + {{ i18n.ts._role._options.canUseTranslator }} diff --git a/packages/frontend/src/pages/admin/roles.vue b/packages/frontend/src/pages/admin/roles.vue index e78a4bbc11..efdf8620ef 100644 --- a/packages/frontend/src/pages/admin/roles.vue +++ b/packages/frontend/src/pages/admin/roles.vue @@ -122,6 +122,14 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.canSearchUsers }} + {{ policies.canSearchUsers ? i18n.ts.yes : i18n.ts.no }} + + {{ i18n.ts.enable }} + + + {{ i18n.ts._role._options.canUseTranslator }} {{ policies.canUseTranslator ? i18n.ts.yes : i18n.ts.no }} diff --git a/packages/frontend/src/pages/search.vue b/packages/frontend/src/pages/search.vue index b6d21a4616..8d2bf9eb42 100644 --- a/packages/frontend/src/pages/search.vue +++ b/packages/frontend/src/pages/search.vue @@ -15,16 +15,22 @@ SPDX-License-Identifier: AGPL-3.0-only - + + + + + {{ i18n.ts.usersSearchNotAvailable }} +