tweak of f3a16bcd6
This commit is contained in:
parent
c59a30ec09
commit
46222d0258
9 changed files with 5 additions and 36 deletions
|
@ -1,11 +0,0 @@
|
|||
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"`);
|
||||
}
|
||||
}
|
|
@ -167,11 +167,6 @@ export class Role {
|
|||
})
|
||||
public displayOrder: number;
|
||||
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
})
|
||||
public isPublicUsers: boolean;
|
||||
|
||||
@Column('jsonb', {
|
||||
default: { },
|
||||
})
|
||||
|
|
|
@ -26,7 +26,6 @@ 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' },
|
||||
|
@ -79,7 +78,6 @@ 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,
|
||||
|
|
|
@ -34,7 +34,6 @@ export const paramDef = {
|
|||
isModerator: { type: 'boolean' },
|
||||
isAdministrator: { type: 'boolean' },
|
||||
isExplorable: { type: 'boolean' },
|
||||
isPublicUsers: { type: 'boolean' },
|
||||
asBadge: { type: 'boolean' },
|
||||
canEditMembersByModerator: { type: 'boolean' },
|
||||
displayOrder: { type: 'number' },
|
||||
|
@ -88,7 +87,6 @@ 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,
|
||||
|
|
|
@ -30,6 +30,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
super(meta, paramDef, async (ps, me) => {
|
||||
const roles = await this.rolesRepository.findBy({
|
||||
isPublic: true,
|
||||
isExplorable: true,
|
||||
});
|
||||
return await this.roleEntityService.packMany(roles, me);
|
||||
});
|
||||
|
|
|
@ -49,14 +49,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
const role = await this.rolesRepository.findOneBy({
|
||||
id: ps.roleId,
|
||||
isPublic: true,
|
||||
isExplorable: true,
|
||||
});
|
||||
|
||||
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 })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue