From e60b774d05ec59c5999834be44b6df381b9ad2ac Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Mon, 10 Jun 2024 17:00:07 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20remove=20grant=5Fsco?= =?UTF-8?q?pe=5Fid=20and=20its=20uses=20(#2325)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13877 --- addons/api/addon/generated/models/role.js | 6 -- addons/api/addon/models/role.js | 9 --- addons/api/mirage/factories/role.js | 2 - addons/api/mirage/serializers/role.js | 2 - .../api/tests/unit/serializers/role-test.js | 1 - ui/admin/app/components/form/role/index.hbs | 77 ------------------- ui/admin/app/components/form/role/index.js | 18 ----- ui/admin/app/routes/onboarding.js | 2 - 8 files changed, 117 deletions(-) delete mode 100644 ui/admin/app/components/form/role/index.js diff --git a/addons/api/addon/generated/models/role.js b/addons/api/addon/generated/models/role.js index db9f0bd9d..fa8d3caf4 100644 --- a/addons/api/addon/generated/models/role.js +++ b/addons/api/addon/generated/models/role.js @@ -22,12 +22,6 @@ export default class GeneratedRoleModel extends BaseModel { }) description; - @attr('string', { - description: - "The scope to which this role applies. Defaults to the role's scope.", - }) - grant_scope_id; - @attr('array', { description: "The scopes to which this role applies. Defaults to the role's scope.", diff --git a/addons/api/addon/models/role.js b/addons/api/addon/models/role.js index f5b6f1326..20f56aa73 100644 --- a/addons/api/addon/models/role.js +++ b/addons/api/addon/models/role.js @@ -33,15 +33,6 @@ export default class RoleModel extends GeneratedRoleModel { */ @attr({ readOnly: true, emptyArrayIfMissing: true }) grant_strings; - /** - * Convenience for looking up the grant scope, if loaded. - */ - get grantScope() { - return this.grant_scope_id - ? this.store.peekRecord('scope', this.grant_scope_id) - : null; - } - /** * A list of IDs for principals of type `user`. * @type {string[]} diff --git a/addons/api/mirage/factories/role.js b/addons/api/mirage/factories/role.js index 448a53c24..088281402 100644 --- a/addons/api/mirage/factories/role.js +++ b/addons/api/mirage/factories/role.js @@ -26,8 +26,6 @@ export default factory.extend({ ], id: () => generateId('r_'), - // TODO: all grant_scope_id instances will be removed in future PR - grant_scope_id: 'this', grant_scope_ids: () => ['this'], /** diff --git a/addons/api/mirage/serializers/role.js b/addons/api/mirage/serializers/role.js index 7c63726b6..b5753dc12 100644 --- a/addons/api/mirage/serializers/role.js +++ b/addons/api/mirage/serializers/role.js @@ -39,8 +39,6 @@ export default ApplicationSerializer.extend({ if (!json.principals.length) delete json.principals; // default grant scopes - // TODO: all grant_scope_id instances will be removed in future PR - if (!json.grant_scope_id) json.grant_scope_id = 'this'; if (json.grant_scope_ids.length === 0) { json.grant_scope_ids = ['this']; } diff --git a/addons/api/tests/unit/serializers/role-test.js b/addons/api/tests/unit/serializers/role-test.js index abf7d56cd..20fe41c28 100644 --- a/addons/api/tests/unit/serializers/role-test.js +++ b/addons/api/tests/unit/serializers/role-test.js @@ -25,7 +25,6 @@ module('Unit | Serializer | role', function (hooks) { name: 'User', description: 'Description', version: 1, - grant_scope_id: null, grant_scope_ids: [], }); }); diff --git a/ui/admin/app/components/form/role/index.hbs b/ui/admin/app/components/form/role/index.hbs index a25bf7a18..144be81f8 100644 --- a/ui/admin/app/components/form/role/index.hbs +++ b/ui/admin/app/components/form/role/index.hbs @@ -51,83 +51,6 @@ {{/if}} - {{#unless @model.isNew}} -
- - {{t 'form.grant_scope.label'}} - - - {{t 'form.grant_scope.help'}} - - - -
    - {{#each @grantScopes as |grantScope|}} -
  • - - - -
      - {{#each grantScope.subScopes as |subScope|}} -
    • - - - -
        - {{#each subScope.subScopes as |subSubScope|}} -
      • - - - -
      • - {{/each}} -
      -
    • - {{/each}} -
    -
  • - {{/each}} -
-
-
-
-
- {{/unless}} {{#if (can 'save model' @model)}}