ロールのユーザーリストを非公開にできるように (#10987)

* ロールのユーザーリストを非公開にできるように

* Changelog update
This commit is contained in:
nenohi
2023-06-10 17:26:48 +09:00
committed by GitHub
parent f69627939b
commit f3a16bcd6d
9 changed files with 45 additions and 1 deletions

View File

@@ -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"`);
}
}

View File

@@ -167,6 +167,11 @@ export class Role {
})
public displayOrder: number;
@Column('boolean', {
default: true,
})
public isPublicUsers: boolean;
@Column('jsonb', {
default: { },
})

View File

@@ -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<typeof meta, typeof paramDef> {
isAdministrator: ps.isAdministrator,
isModerator: ps.isModerator,
isExplorable: ps.isExplorable,
isPublicUsers: ps.isPublicUsers,
asBadge: ps.asBadge,
canEditMembersByModerator: ps.canEditMembersByModerator,
displayOrder: ps.displayOrder,

View File

@@ -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<typeof meta, typeof paramDef> {
isModerator: ps.isModerator,
isAdministrator: ps.isAdministrator,
isExplorable: ps.isExplorable,
isPublicUsers: ps.isPublicUsers,
asBadge: ps.asBadge,
canEditMembersByModerator: ps.canEditMembersByModerator,
displayOrder: ps.displayOrder,

View File

@@ -54,6 +54,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
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 })