Skip to content

Commit

Permalink
Gate sync overview route for users without access (#27320)
Browse files Browse the repository at this point in the history
* routes: add redirect if user does not have access to sync

* tests: verify redirect on sync overview page happens

* tests: organize tests modules to ensure enterprise is explicitly set up
  • Loading branch information
Noelle Daley authored Jun 3, 2024
1 parent 6fd9b21 commit 51bf477
Show file tree
Hide file tree
Showing 2 changed files with 259 additions and 158 deletions.
8 changes: 8 additions & 0 deletions ui/lib/sync/addon/routes/secrets/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { service } from '@ember/service';
import { hash } from 'rsvp';

import type FlagsService from 'vault/services/flags';
import type RouterService from '@ember/routing/router-service';
import type StoreService from 'vault/services/store';
import type VersionService from 'vault/services/version';

export default class SyncSecretsOverviewRoute extends Route {
@service declare readonly router: RouterService;
@service declare readonly store: StoreService;
@service declare readonly flags: FlagsService;
@service declare readonly version: VersionService;
Expand All @@ -34,4 +36,10 @@ export default class SyncSecretsOverviewRoute extends Route {
: [],
});
}

redirect() {
if (!this.flags.showSecretsSync) {
this.router.replaceWith('vault.cluster.dashboard');
}
}
}
Loading

0 comments on commit 51bf477

Please sign in to comment.