File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
188
188
throw new ApplicationError ( ErrorCodes . BAD_REQUEST , "organizationId is required" ) ;
189
189
}
190
190
191
- const members = await this . orgService . listMembers ( ctxUserId ( ) , req . organizationId ) ;
191
+ const members = await this . orgService . listMembers ( ctxUserId ( ) , req . organizationId , true ) ;
192
192
//TODO pagination
193
193
const response = new ListOrganizationMembersResponse ( ) ;
194
194
response . members = members . map ( ( member ) => this . apiConverter . toOrganizationMember ( member ) ) ;
@@ -218,7 +218,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
218
218
this . apiConverter . fromOrgMemberRole ( req . role ) ,
219
219
) ;
220
220
const member = await this . orgService
221
- . listMembers ( ctxUserId ( ) , req . organizationId )
221
+ . listMembers ( ctxUserId ( ) , req . organizationId , true )
222
222
. then ( ( members ) => members . find ( ( member ) => member . userId === req . userId ) ) ;
223
223
return new UpdateOrganizationMemberResponse ( {
224
224
member : member && this . apiConverter . toOrganizationMember ( member ) ,
Original file line number Diff line number Diff line change @@ -263,9 +263,13 @@ export class OrganizationService {
263
263
}
264
264
265
265
/**
266
- * List members of an organization, excluding the built-in installation admin user and all deleted users .
266
+ * List members of an organization, excluding all deleted users and optionally the built-in installation admin user.
267
267
*/
268
- public async listMembers ( userId : string , orgId : string ) : Promise < OrgMemberInfo [ ] > {
268
+ public async listMembers (
269
+ userId : string ,
270
+ orgId : string ,
271
+ excludeInstallationAdmin ?: boolean ,
272
+ ) : Promise < OrgMemberInfo [ ] > {
269
273
await this . auth . checkPermissionOnOrganization ( userId , "read_members" , orgId ) ;
270
274
const members = await this . teamDB . findMembersByTeam ( orgId ) ;
271
275
@@ -278,7 +282,7 @@ export class OrganizationService {
278
282
if ( user . markedDeleted ) {
279
283
return null ;
280
284
}
281
- if ( user . id === BUILTIN_INSTLLATION_ADMIN_USER_ID ) {
285
+ if ( excludeInstallationAdmin && user . id === BUILTIN_INSTLLATION_ADMIN_USER_ID ) {
282
286
return null ;
283
287
}
284
288
You can’t perform that action at this time.
0 commit comments