diff --git a/ui/admin/app/routes/scopes/scope/auth-methods.js b/ui/admin/app/routes/scopes/scope/auth-methods.js index 938ce6d16..687c5ef81 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods.js @@ -60,10 +60,14 @@ export default class ScopesScopeAuthMethodsRoute extends Route { ) async save(authMethod) { await authMethod.save(); - await this.transitionTo( - 'scopes.scope.auth-methods.auth-method', - authMethod - ); + if (this.can.can('read model', authMethod)) { + await this.transitionTo( + 'scopes.scope.auth-methods.auth-method', + authMethod + ); + } else { + await this.transitionTo('scopes.scope.auth-methods'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/auth-methods/auth-method/accounts.js b/ui/admin/app/routes/scopes/scope/auth-methods/auth-method/accounts.js index d4e1ab55a..6166ae16b 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods/auth-method/accounts.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods/auth-method/accounts.js @@ -60,10 +60,14 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route adapterOptions.password = password; } await account.save({ adapterOptions }); - await this.transitionTo( - 'scopes.scope.auth-methods.auth-method.accounts.account', - account - ); + if (this.can.can('read model', account)) { + await this.transitionTo( + 'scopes.scope.auth-methods.auth-method.accounts.account', + account + ); + } else { + await this.transitionTo('scopes.scope.auth-methods.auth-method.accounts'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js index 06748f330..d38d9a2f9 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js @@ -55,10 +55,16 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari ) async save(credentialLibrary) { await credentialLibrary.save(); - await this.transitionTo( - 'scopes.scope.credential-stores.credential-store.credential-libraries.credential-library', - credentialLibrary - ); + if (this.can.can('read model', credentialLibrary)) { + await this.transitionTo( + 'scopes.scope.credential-stores.credential-store.credential-libraries.credential-library', + credentialLibrary + ); + } else { + await this.transitionTo( + 'scopes.scope.credential-stores.credential-store.credential-libraries' + ); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/groups.js b/ui/admin/app/routes/scopes/scope/groups.js index 1784799cc..e1346ae4d 100644 --- a/ui/admin/app/routes/scopes/scope/groups.js +++ b/ui/admin/app/routes/scopes/scope/groups.js @@ -57,7 +57,11 @@ export default class ScopesScopeGroupsRoute extends Route { ) async save(group) { await group.save(); - await this.transitionTo('scopes.scope.groups.group', group); + if (this.can.can('read model', group)) { + await this.transitionTo('scopes.scope.groups.group', group); + } else { + await this.transitionTo('scopes.scope.groups'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js index 36d341bc4..d70b5dab0 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js @@ -59,10 +59,16 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou ) async save(hostSet) { await hostSet.save(); - await this.transitionTo( - 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set', - hostSet - ); + if (this.can.can('read model', hostSet)) { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set', + hostSet + ); + } else { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.host-sets' + ); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js index 5969a8b67..cb91be6ed 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js @@ -58,10 +58,14 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route ) async save(host) { await host.save(); - await this.transitionTo( - 'scopes.scope.host-catalogs.host-catalog.hosts.host', - host - ); + if (this.can.can('read model', host)) { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.hosts.host', + host + ); + } else { + await this.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/roles.js b/ui/admin/app/routes/scopes/scope/roles.js index cbc1dfcc5..f83c69135 100644 --- a/ui/admin/app/routes/scopes/scope/roles.js +++ b/ui/admin/app/routes/scopes/scope/roles.js @@ -58,7 +58,11 @@ export default class ScopesScopeRolesRoute extends Route { ) async save(role) { await role.save(); - await this.transitionTo('scopes.scope.roles.role', role); + if (this.can.can('read model', role)) { + await this.transitionTo('scopes.scope.roles.role', role); + } else { + await this.transitionTo('scopes.scope.roles'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/targets.js b/ui/admin/app/routes/scopes/scope/targets.js index 2adb5ca84..85a27eab1 100644 --- a/ui/admin/app/routes/scopes/scope/targets.js +++ b/ui/admin/app/routes/scopes/scope/targets.js @@ -60,7 +60,11 @@ export default class ScopesScopeTargetsRoute extends Route { ) async save(target) { await target.save(); - await this.transitionTo('scopes.scope.targets.target', target); + if (this.can.can('read model', target)) { + await this.transitionTo('scopes.scope.targets.target', target); + } else { + await this.transitionTo('scopes.scope.targets'); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/users.js b/ui/admin/app/routes/scopes/scope/users.js index aa3dde96a..6512c6aeb 100644 --- a/ui/admin/app/routes/scopes/scope/users.js +++ b/ui/admin/app/routes/scopes/scope/users.js @@ -59,7 +59,11 @@ export default class ScopesScopeUsersRoute extends Route { ) async save(user) { await user.save(); - await this.transitionTo('scopes.scope.users.user', user); + if (this.can.can('read model', user)) { + await this.transitionTo('scopes.scope.users.user', user); + } else { + await this.transitionTo('scopes.scope.users'); + } this.refresh(); } diff --git a/ui/admin/app/templates/scopes/scope/groups/index.hbs b/ui/admin/app/templates/scopes/scope/groups/index.hbs index 1e5f038db..2026ac1c5 100644 --- a/ui/admin/app/templates/scopes/scope/groups/index.hbs +++ b/ui/admin/app/templates/scopes/scope/groups/index.hbs @@ -71,7 +71,6 @@ as |message| > - {{t 'resources.group.description'}} {{#if (can 'list collection' this.scope collection='groups')}} {{! can list (at least): show default welcome message}} {{t 'resources.group.description'}}