diff --git a/CHANGELOG.md b/CHANGELOG.md index 9806e0305..55dab31d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,17 @@ - --> +## 13.x.x (unreleased) + +### General +- ロールが付与されているユーザーリストを非公開にできるように + +### Client +- + +### Server +- + ## 13.13.1 diff --git a/locales/index.d.ts b/locales/index.d.ts index eed29f408..638ac10e7 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1431,6 +1431,8 @@ export interface Locale { "isConditionalRole": string; "isPublic": string; "descriptionOfIsPublic": string; + "isPublicUsers": string; + "descriptionOfIsPublicUsers": string; "options": string; "policies": string; "baseRole": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 723d0ac98..5a7a2afd5 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1353,7 +1353,9 @@ _role: condition: "条件" isConditionalRole: "これはコンディショナルロールです。" isPublic: "ロールを公開" - descriptionOfIsPublic: "ロールにアサインされたユーザーを誰でも見ることができます。また、ユーザーのプロフィールでこのロールが表示されます。" + descriptionOfIsPublic: "ユーザーのプロフィールでこのロールが表示されます。" + isPublicUsers: "ユーザーリストを公開" + descriptionOfIsPublicUsers: "ロールにアサインされたユーザーのリストを誰でも見ることができます。" options: "オプション" policies: "ポリシー" baseRole: "ベースロール" diff --git a/packages/backend/migration/1686381571997-roleuserhidden.js b/packages/backend/migration/1686381571997-roleuserhidden.js new file mode 100644 index 000000000..5cfa9ab87 --- /dev/null +++ b/packages/backend/migration/1686381571997-roleuserhidden.js @@ -0,0 +1,11 @@ +export class roleuserhidden1686381571997 { + name = 'roleuserhidden1686381571997' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "role" ADD "isPublicUsers" boolean NOT NULL DEFAULT true`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "isPublicUsers"`); + } +} diff --git a/packages/backend/src/models/entities/Role.ts b/packages/backend/src/models/entities/Role.ts index 61f40d59d..067f7bf62 100644 --- a/packages/backend/src/models/entities/Role.ts +++ b/packages/backend/src/models/entities/Role.ts @@ -167,6 +167,11 @@ export class Role { }) public displayOrder: number; + @Column('boolean', { + default: true, + }) + public isPublicUsers: boolean; + @Column('jsonb', { default: { }, }) diff --git a/packages/backend/src/server/api/endpoints/admin/roles/create.ts b/packages/backend/src/server/api/endpoints/admin/roles/create.ts index 916172f54..1cf3157ac 100644 --- a/packages/backend/src/server/api/endpoints/admin/roles/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/roles/create.ts @@ -26,6 +26,7 @@ export const paramDef = { isModerator: { type: 'boolean' }, isAdministrator: { type: 'boolean' }, isExplorable: { type: 'boolean', default: false }, // optional for backward compatibility + isPublicUsers: { type: 'boolean', default: true }, // optional for backward compatibility asBadge: { type: 'boolean' }, canEditMembersByModerator: { type: 'boolean' }, displayOrder: { type: 'number' }, @@ -78,6 +79,7 @@ export default class extends Endpoint { isAdministrator: ps.isAdministrator, isModerator: ps.isModerator, isExplorable: ps.isExplorable, + isPublicUsers: ps.isPublicUsers, asBadge: ps.asBadge, canEditMembersByModerator: ps.canEditMembersByModerator, displayOrder: ps.displayOrder, diff --git a/packages/backend/src/server/api/endpoints/admin/roles/update.ts b/packages/backend/src/server/api/endpoints/admin/roles/update.ts index 467f157a6..5108c4da1 100644 --- a/packages/backend/src/server/api/endpoints/admin/roles/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/roles/update.ts @@ -34,6 +34,7 @@ export const paramDef = { isModerator: { type: 'boolean' }, isAdministrator: { type: 'boolean' }, isExplorable: { type: 'boolean' }, + isPublicUsers: { type: 'boolean' }, asBadge: { type: 'boolean' }, canEditMembersByModerator: { type: 'boolean' }, displayOrder: { type: 'number' }, @@ -87,6 +88,7 @@ export default class extends Endpoint { isModerator: ps.isModerator, isAdministrator: ps.isAdministrator, isExplorable: ps.isExplorable, + isPublicUsers: ps.isPublicUsers, asBadge: ps.asBadge, canEditMembersByModerator: ps.canEditMembersByModerator, displayOrder: ps.displayOrder, diff --git a/packages/backend/src/server/api/endpoints/roles/users.ts b/packages/backend/src/server/api/endpoints/roles/users.ts index 607dc2420..f4b30286a 100644 --- a/packages/backend/src/server/api/endpoints/roles/users.ts +++ b/packages/backend/src/server/api/endpoints/roles/users.ts @@ -54,6 +54,9 @@ export default class extends Endpoint { if (role == null) { throw new ApiError(meta.errors.noSuchRole); } + if (!role.isPublicUsers) { + return []; + } const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId) .andWhere('assign.roleId = :roleId', { roleId: role.id }) diff --git a/packages/frontend/src/pages/admin/roles.editor.vue b/packages/frontend/src/pages/admin/roles.editor.vue index a1fa9d293..6aeef6cb1 100644 --- a/packages/frontend/src/pages/admin/roles.editor.vue +++ b/packages/frontend/src/pages/admin/roles.editor.vue @@ -63,6 +63,11 @@ + + + + +
@@ -501,6 +506,7 @@ const save = throttle(100, () => { isModerator: role.isModerator, isPublic: role.isPublic, isExplorable: role.isExplorable, + isPublicUsers: role.isPublicUsers, asBadge: role.asBadge, canEditMembersByModerator: role.canEditMembersByModerator, policies: role.policies,