diff --git a/ui/core/app/components/bread-crumbs.hbs b/ui/core/app/components/bread-crumbs.hbs
index d902b4d1b..3c30c0e0c 100644
--- a/ui/core/app/components/bread-crumbs.hbs
+++ b/ui/core/app/components/bread-crumbs.hbs
@@ -2,12 +2,14 @@
{{#if this.scope.org}}
{{#unless this.scope.org.isGlobal}}
-
- {{t "resources.org.title_plural"}}
-
-
- {{this.scope.org.displayName}}
-
+ {{#if this.session.data.authenticated.isGlobal}}
+
+ {{t "resources.org.title_plural"}}
+
+
+ {{this.scope.org.displayName}}
+
+ {{/if}}
{{/unless}}
{{/if}}
diff --git a/ui/core/app/components/bread-crumbs.js b/ui/core/app/components/bread-crumbs.js
index be3c4921b..38482914d 100644
--- a/ui/core/app/components/bread-crumbs.js
+++ b/ui/core/app/components/bread-crumbs.js
@@ -5,6 +5,7 @@ export default class crumbs extends BreadCrumbsComponent {
// =services
+ @service session;
@service scope;
}
diff --git a/ui/core/app/routes/scopes/scope/authenticate.js b/ui/core/app/routes/scopes/scope/authenticate.js
index 53bafba60..1c49215a8 100644
--- a/ui/core/app/routes/scopes/scope/authenticate.js
+++ b/ui/core/app/routes/scopes/scope/authenticate.js
@@ -22,7 +22,7 @@ export default class ScopesScopeAuthenticateRoute extends Route {
const { id: scope_id } = this.modelFor('scopes.scope');
return hash({
scope: this.modelFor('scopes.scope'),
- scopes: this.modelFor('scopes'),
+ scopes: this.modelFor('scopes').filter(scope => scope.isOrg),
authMethods: this.store.query('auth-method', { scope_id }),
// for integration testing:
diff --git a/ui/core/app/routes/scopes/scope/edit.js b/ui/core/app/routes/scopes/scope/edit.js
index b77391dbd..a7b74c5ef 100644
--- a/ui/core/app/routes/scopes/scope/edit.js
+++ b/ui/core/app/routes/scopes/scope/edit.js
@@ -1,4 +1,18 @@
import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
export default class ScopesScopeEditRoute extends Route {
+
+ // =services
+
+ @service session;
+
+ // =methods
+
+ /**
+ * If arriving here unauthenticated, redirect to index for further processing.
+ */
+ beforeModel() {
+ if (!this.session.isAuthenticated) this.transitionTo('index');
+ }
}
diff --git a/ui/core/app/routes/scopes/scope/host-catalogs.js b/ui/core/app/routes/scopes/scope/host-catalogs.js
index 03adfed44..5c082051c 100644
--- a/ui/core/app/routes/scopes/scope/host-catalogs.js
+++ b/ui/core/app/routes/scopes/scope/host-catalogs.js
@@ -10,9 +10,17 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
@service intl;
@service notify;
+ @service session;
// =methods
+ /**
+ * If arriving here unauthenticated, redirect to index for further processing.
+ */
+ beforeModel() {
+ if (!this.session.isAuthenticated) this.transitionTo('index');
+ }
+
/**
* Loads all host catalogs under the current scope.
* @return {Promise{[HostCatalogModel]}}
diff --git a/ui/core/app/routes/scopes/scope/new.js b/ui/core/app/routes/scopes/scope/new.js
index c518a483a..0ab9f7f5b 100644
--- a/ui/core/app/routes/scopes/scope/new.js
+++ b/ui/core/app/routes/scopes/scope/new.js
@@ -1,8 +1,21 @@
import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
export default class ScopesScopeNewRoute extends Route {
+
+ // =services
+
+ @service session;
+
// =methods
+ /**
+ * If arriving here unauthenticated, redirect to index for further processing.
+ */
+ beforeModel() {
+ if (!this.session.isAuthenticated) this.transitionTo('index');
+ }
+
/**
* Creates a new unsaved scope belonging to the current scope.
* @return {ScopeModel}
diff --git a/ui/core/app/routes/scopes/scope/scopes.js b/ui/core/app/routes/scopes/scope/scopes.js
index a678edcc9..933bfc531 100644
--- a/ui/core/app/routes/scopes/scope/scopes.js
+++ b/ui/core/app/routes/scopes/scope/scopes.js
@@ -14,12 +14,10 @@ export default class ScopesScopeScopesRoute extends Route {
// =methods
/**
- * Redirects to scopes/scope/authenticate if unauthenticated.
+ * If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
- if (!this.session.isAuthenticated) {
- this.transitionTo('scopes.scope.authenticate');
- }
+ if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
diff --git a/ui/core/app/routes/scopes/scope/sessions.js b/ui/core/app/routes/scopes/scope/sessions.js
index 7f64fdb67..a8ae5eb19 100644
--- a/ui/core/app/routes/scopes/scope/sessions.js
+++ b/ui/core/app/routes/scopes/scope/sessions.js
@@ -15,6 +15,7 @@ export default class ScopesScopeSessionsRoute extends Route {
@service intl;
@service notify;
+ @service session;
// =attributes
@@ -37,6 +38,13 @@ export default class ScopesScopeSessionsRoute extends Route {
// =methods
+ /**
+ * If arriving here unauthenticated, redirect to index for further processing.
+ */
+ beforeModel() {
+ if (!this.session.isAuthenticated) this.transitionTo('index');
+ }
+
/**
* Loads all sessions under the current scope and encapsulates them into
* an array of objects containing their associated users and targets.
diff --git a/ui/core/app/routes/scopes/scope/targets.js b/ui/core/app/routes/scopes/scope/targets.js
index 30f049682..f1da50944 100644
--- a/ui/core/app/routes/scopes/scope/targets.js
+++ b/ui/core/app/routes/scopes/scope/targets.js
@@ -10,9 +10,17 @@ export default class ScopesScopeTargetsRoute extends Route {
@service intl;
@service notify;
+ @service session;
// =methods
+ /**
+ * If arriving here unauthenticated, redirect to index for further processing.
+ */
+ beforeModel() {
+ if (!this.session.isAuthenticated) this.transitionTo('index');
+ }
+
/**
* Loads all targets under current scope.
* @return {Promise{[TargetModel]}}
diff --git a/ui/core/app/templates/scopes/scope.hbs b/ui/core/app/templates/scopes/scope.hbs
index 0e7de3048..278755d24 100644
--- a/ui/core/app/templates/scopes/scope.hbs
+++ b/ui/core/app/templates/scopes/scope.hbs
@@ -131,15 +131,23 @@
{{/unless}}
- {{#unless @model.isGlobal}}
+ {{#if @model.isOrg}}
+ {{#if this.session.data.authenticated.isGlobal}}
+
+
+ {{t "resources.org.messages.settings.title"}}
+
+
+ {{/if}}
+ {{/if}}
+
+ {{#if @model.isProject}}
- {{t (if @model.isOrg
- "resources.org.messages.settings.title"
- "resources.project.messages.settings.title")}}
+ {{t "resources.project.messages.settings.title"}}
- {{/unless}}
+ {{/if}}
{{/if}}
diff --git a/ui/core/app/templates/scopes/scope/authenticate.hbs b/ui/core/app/templates/scopes/scope/authenticate.hbs
index 0bee46a27..ccabf58d4 100644
--- a/ui/core/app/templates/scopes/scope/authenticate.hbs
+++ b/ui/core/app/templates/scopes/scope/authenticate.hbs
@@ -14,6 +14,9 @@
@text={{t "actions.choose-different-org"}}
@icon="user-organization"
as |dropdown|>
+
+ {{t "titles.global"}}
+
{{#each this.sortedScopes as |scope|}}
{{scope.displayName}}
diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js
index d9d5c3a0e..e4965ce8e 100644
--- a/ui/core/tests/acceptance/authentication-test.js
+++ b/ui/core/tests/acceptance/authentication-test.js
@@ -39,11 +39,16 @@ module('Acceptance | authentication', function (hooks) {
let authMethodGlobalAuthenticateURL;
let changePasswordURL;
let orgsURL;
+ let orgEditURL;
+ let newProjectURL;
let projectsURL;
let usersURL;
let groupsURL;
let rolesURL;
let authMethodsURL;
+ let hostCatalogsURL;
+ let sessionsURL;
+ let targetsURL;
hooks.beforeEach(function () {
invalidateSession();
@@ -73,11 +78,16 @@ module('Acceptance | authentication', function (hooks) {
authMethodAuthenticateURL = `/scopes/${orgScopeID}/authenticate/${authMethodID}`;
changePasswordURL = `/account/change-password`;
orgsURL = `/scopes/global/scopes`;
+ orgEditURL = `/scopes/${orgScopeID}/edit`;
+ newProjectURL = `/scopes/${orgScopeID}/new`;
projectsURL = `/scopes/${orgScopeID}/scopes`;
usersURL = `/scopes/${orgScopeID}/users`;
groupsURL = `/scopes/${orgScopeID}/groups`;
rolesURL = `/scopes/${orgScopeID}/roles`;
authMethodsURL = `/scopes/${orgScopeID}/auth-methods`;
+ hostCatalogsURL = `/scopes/${orgScopeID}/host-catalogs`;
+ sessionsURL = `/scopes/${orgScopeID}/sessions`;
+ targetsURL = `/scopes/${orgScopeID}/targets`;
});
test('visiting auth methods authenticate route redirects to first auth method', async function (assert) {
@@ -129,10 +139,24 @@ module('Acceptance | authentication', function (hooks) {
assert.notOk(currentSession().isAuthenticated);
});
- test('visiting projects while unauthenticated redirects to first org authenticate method', async function (assert) {
+ test('visiting org edit while unauthenticated redirects to first global authenticate method', async function (assert) {
+ assert.expect(2);
+ await visit(orgEditURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
+ assert.notOk(currentSession().isAuthenticated);
+ });
+
+ test('visiting projects while unauthenticated redirects to first global authenticate method', async function (assert) {
assert.expect(2);
await visit(projectsURL);
- assert.equal(currentURL(), authMethodAuthenticateURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
+ assert.notOk(currentSession().isAuthenticated);
+ });
+
+ test('visiting new project while unauthenticated redirects to first global authenticate method', async function (assert) {
+ assert.expect(2);
+ await visit(newProjectURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
assert.notOk(currentSession().isAuthenticated);
});
@@ -157,6 +181,27 @@ module('Acceptance | authentication', function (hooks) {
assert.notOk(currentSession().isAuthenticated);
});
+ test('visiting host catalogs while unauthenticated redirects to first global authenticate method', async function (assert) {
+ assert.expect(2);
+ await visit(hostCatalogsURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
+ assert.notOk(currentSession().isAuthenticated);
+ });
+
+ test('visiting targets while unauthenticated redirects to first global authenticate method', async function (assert) {
+ assert.expect(2);
+ await visit(targetsURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
+ assert.notOk(currentSession().isAuthenticated);
+ });
+
+ test('visiting sessions while unauthenticated redirects to first global authenticate method', async function (assert) {
+ assert.expect(2);
+ await visit(sessionsURL);
+ assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
+ assert.notOk(currentSession().isAuthenticated);
+ });
+
test('visiting auth methods while unauthenticated redirects to first global authenticate method', async function (assert) {
assert.expect(2);
await visit(authMethodsURL);