From 51e10d977e807f4d52e563dac6541f72792149dc Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Fri, 14 Aug 2020 15:19:49 +0100 Subject: [PATCH] Add some time saving comments to cf permissions checker --- .../src/user-permissions/cf-user-permissions-checkers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts index 1aead1cd0f..48a4be5af1 100644 --- a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts +++ b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts @@ -191,7 +191,9 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker endpointGuid?: string, orgOrSpaceGuid?: string, allSpacesWithinOrg = false - ) { + ): Observable { + // In some situations the observable returned here is not subscribed to (for example due to applyAdminCheck). + // This is bad (we should skip this function entirely) and should be fixed. This would require a thorough appraisal and overhaul. if (type === CfPermissionTypes.ENDPOINT_SCOPE) { if (!endpointGuid) { return of(false); @@ -357,6 +359,7 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker return of(true); } if (isReadOnly) { + // This is bad, we should not assume that the check type wants a negative result if the user only has 'read only' rights. return of(false); } return check$;