diff --git a/ui/core/app/components/form/role/index.hbs b/ui/core/app/components/form/role/index.hbs index 0e024b1fb..2b94423a5 100644 --- a/ui/core/app/components/form/role/index.hbs +++ b/ui/core/app/components/form/role/index.hbs @@ -44,6 +44,44 @@ {{/if}} + + + {{#each @grantScopes as |grantScope|}} + + + + {{#each grantScope.subScopes as |subScope|}} + + + + {{#each subScope.subScopes as |subSubScope|}} + + + + {{/each}} + {{/each}} + {{/each}} + + +        {{t "form.grant_scope.help"}} + + + +
+
+ ({ + model: scope, + subScopes: this.store.query('scope', { scope_id: scope.id }) + })); + const grantScopes = [{ + model: defaultScope, + subScopes + }]; + this.set('grantScopes', grantScopes); + } + + /** + * Adds `grantScopes` to the context. + * @param {Controller} controller + */ + setupController(controller) { + super.setupController(...arguments); + controller.set('grantScopes', this.grantScopes); + } + +} diff --git a/ui/core/app/styles/app.scss b/ui/core/app/styles/app.scss index 609a7aced..5de632e91 100644 --- a/ui/core/app/styles/app.scss +++ b/ui/core/app/styles/app.scss @@ -42,6 +42,18 @@ width: 100%; } } + + .rose-dropdown { + .rose-dropdown-item { + &.indent-1 { + padding-left: sizing.rems(s) * 2; + } + + &.indent-2 { + padding-left: sizing.rems(l) + sizing.rems(m); + } + } + } } .rose-table { diff --git a/ui/core/app/templates/scopes/scope/roles/role/index.hbs b/ui/core/app/templates/scopes/scope/roles/role/index.hbs index e72610ec6..44c14fe3a 100644 --- a/ui/core/app/templates/scopes/scope/roles/role/index.hbs +++ b/ui/core/app/templates/scopes/scope/roles/role/index.hbs @@ -1,6 +1,6 @@ - diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index 4060a9cd1..aa2f2fac1 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -19,6 +19,7 @@ module('Acceptance | roles', function (hooks) { scopes: { global: null, org: null, + project: null, }, role: null, }; @@ -36,6 +37,13 @@ module('Acceptance | roles', function (hooks) { type: 'org', scope: { id: 'global', type: 'global' }, }); + // The project scope is not yet used for role tests (though it will be + // in the future). This is created simply to test the grant scope loading + // mechanism. + instances.scopes.project = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: instances.scopes.org.type }, + }); instances.role = this.server.create('role', { scope: instances.scopes.org, }, 'withPrincipals'); diff --git a/ui/core/translations/form/en-us.yaml b/ui/core/translations/form/en-us.yaml index de24444fc..2971b77b6 100644 --- a/ui/core/translations/form/en-us.yaml +++ b/ui/core/translations/form/en-us.yaml @@ -43,3 +43,6 @@ session_connection_limit: help: The maximum number of connections allowed per session. For unlimited, specify "-1". host_set: label: Host Set +grant_scope: + label: Grant Scope + help: Specify the scope to which this role applies.