Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide app vars tab if user is not a space developer #3247

Merged
merged 5 commits into from
Dec 13, 2018

Conversation

nwmac
Copy link
Contributor

@nwmac nwmac commented Nov 27, 2018

Fixes #2725

@nwmac nwmac self-assigned this Nov 27, 2018
@cfdreddbot
Copy link

✅ Hey nwmac! The commit authors and yourself have already signed the CLA.

@codecov
Copy link

codecov bot commented Nov 27, 2018

Codecov Report

Merging #3247 into v2-master will decrease coverage by 0.02%.
The diff coverage is 65.39%.

@@              Coverage Diff              @@
##           v2-master    #3247      +/-   ##
=============================================
- Coverage      71.04%   71.01%   -0.03%     
=============================================
  Files            634      639       +5     
  Lines          27827    28029     +202     
  Branches        6336     6387      +51     
=============================================
+ Hits           19769    19906     +137     
- Misses          8058     8123      +65

secrets.yaml.sys Outdated
@@ -0,0 +1,57 @@
# E2E Configuration file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be in the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

@@ -213,6 +215,15 @@ export class ApplicationService {
this.appEnvVars = this.appEnvVarsService.createEnvVarsObs(this.appGuid, this.cfGuid);
}

public getApplicationEnvVarsMonitor() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better placed in ApplicationEnvVarsHelper alongside createEnvVarsObs

@@ -110,9 +111,28 @@ export class ApplicationTabsBaseComponent implements OnInit, OnDestroy {
}
});

// Listen for the response to the env vars API call - if it errors then we hide the variables tab
// This is simpler than the code to check permissions since we make the env vars request anyway
const appDoesNotHaveEnvVars$ = this.applicationService.getApplicationEnvVarsMonitor().entityRequest$.pipe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we should stick to the permissions. That way the user can then refresh the list and still see the env vars. To switch would need to

  1. Add new ENV_VARS_VIEW entry to the CurrentUserPermissions enum in current-user-ermissions.config.ts
  2. Add entry for new enum value to permissionConfigs in the same file (which just needs to be look for space dev)
  3. In application-tabs-base.component.ts import CurrentUserPermissionsService and use it's can function with something like can(<new env vars view enum>, <endppoint guid>, <space giud>)

@richard-cox richard-cox added needs attention This PR needs attention and removed in review labels Dec 6, 2018
@nwmac nwmac removed the needs attention This PR needs attention label Dec 12, 2018
@richard-cox richard-cox merged commit eecd133 into v2-master Dec 13, 2018
@richard-cox richard-cox deleted the hide-app-vars-no-permission branch December 13, 2018 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants