From 52904dc6394277c55a9926713b822f7bcb8bf854 Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Thu, 16 Jun 2022 18:11:11 -0500 Subject: [PATCH] Chore add onboarding role (#1142) * chore: generate a role authorized to access the generated onboarding target --- addons/core/translations/en-us.yaml | 2 + .../quick-setup/create-resources.js | 13 ++- ui/admin/app/styles/app.scss | 21 ++++- .../quick-setup/create-resources/success.hbs | 93 ++++++++++--------- 4 files changed, 83 insertions(+), 46 deletions(-) diff --git a/addons/core/translations/en-us.yaml b/addons/core/translations/en-us.yaml index 8e9f86116..3301faa99 100644 --- a/addons/core/translations/en-us.yaml +++ b/addons/core/translations/en-us.yaml @@ -77,10 +77,12 @@ onboarding: desktop: Using Boundary Desktop developers: Developers controller: Controller URL + creation-success: We have created your scopes and target descriptions: download: Download the Boundary Desktop app to browse and connect to targets (available for Windows, Mac, and Linux) developers: You can also connect to targets using the Boundary CLI or API. controller: Use this URL to sign in to Boundary + role: You can now connect to the target with the Boundary Desktop app, command-line (CLI) or API. Boundary grants access to resources based on roles, and we have added you to the `demo` role to give you access to this target. Make sure to add this role to any new users if you want them to access it too. links: install: Install the Boundary Desktop app learn: Learn about Boundary Desktop app diff --git a/ui/admin/app/routes/onboarding/quick-setup/create-resources.js b/ui/admin/app/routes/onboarding/quick-setup/create-resources.js index 98caa1438..bf2d303fc 100644 --- a/ui/admin/app/routes/onboarding/quick-setup/create-resources.js +++ b/ui/admin/app/routes/onboarding/quick-setup/create-resources.js @@ -43,6 +43,9 @@ export default class OnboardingQuickSetupCreateResourcesRoute extends Route { name: 'CRM Database target', description: 'Sample target created by quick setup', }), + role: this.store.createRecord('role', { + name: 'crm_db_connect_role', + }), }; } @@ -57,13 +60,14 @@ export default class OnboardingQuickSetupCreateResourcesRoute extends Route { try { await this.createOnboardingResourcesAndRedirect(hostAddress, targetPort); } catch (e) { + console.log(e); this.router.replaceWith('scopes.scope', 'global'); throw new Error(); } } async createOnboardingResourcesAndRedirect(hostAddress, targetPort) { - const { org, project, hostCatalog, hostSet, host, target } = + const { org, project, hostCatalog, hostSet, host, target, role } = this.currentModel; // The Procedure await org.save(); @@ -82,6 +86,13 @@ export default class OnboardingQuickSetupCreateResourcesRoute extends Route { target.default_port = targetPort; await target.save(); await target.addHostSources([hostSet.id]); + role.scopeID = org.id; + role.grant_scope_id = project.id; + await role.save(); + await role.saveGrantStrings([ + `type=target;actions=list`, + `id=${target.id};actions=authorize-session`, + ]); this.router.transitionTo( 'onboarding.quick-setup.create-resources.success' ); diff --git a/ui/admin/app/styles/app.scss b/ui/admin/app/styles/app.scss index 6e29c36b4..871a18607 100644 --- a/ui/admin/app/styles/app.scss +++ b/ui/admin/app/styles/app.scss @@ -296,9 +296,22 @@ } } -.onboarding-quick-setup-success-boundary { +.onboarding-quick-setup-success-role { + span { + display: flex; + } + + h3 { + font-size: 16px; + font-weight: 600; + letter-spacing: -0.5px; + line-height: 24px; + margin-left: sizing.rems(xs); + margin-top: 0; + } + .rose-icon { - margin-bottom: sizing.rems(xs); + color: var(--success); } } @@ -312,6 +325,10 @@ margin-left: sizing.rems(xs); margin-top: sizing.rems(xxs); } + + .rose-icon { + margin-bottom: sizing.rems(xs); + } } .onboarding-quick-setup-success-link { diff --git a/ui/admin/app/templates/onboarding/quick-setup/create-resources/success.hbs b/ui/admin/app/templates/onboarding/quick-setup/create-resources/success.hbs index 969b606db..cd13300d5 100644 --- a/ui/admin/app/templates/onboarding/quick-setup/create-resources/success.hbs +++ b/ui/admin/app/templates/onboarding/quick-setup/create-resources/success.hbs @@ -5,53 +5,60 @@

{{t 'onboarding.success.titles.connect'}}

<:body> -
-
- +
+ +

- {{t 'onboarding.success.titles.desktop'}} + {{t 'onboarding.success.titles.creation-success'}}

+
+

{{t 'onboarding.success.descriptions.role'}}

+
+
+ +

+ {{t 'onboarding.success.titles.desktop'}} +

+
+ +

{{t 'onboarding.success.descriptions.download'}}

+ + + + {{t 'onboarding.success.links.install'}} + + + + + {{t 'onboarding.success.links.learn'}} + + +
+

{{t 'onboarding.success.titles.controller'}}

+

{{t 'onboarding.success.descriptions.controller'}}

+
+ + {{this.model.origin}} +
+
-

{{t 'onboarding.success.descriptions.download'}}

- - - - {{t 'onboarding.success.links.install'}} - - - - - {{t 'onboarding.success.links.learn'}} - - -
-

{{t 'onboarding.success.titles.controller'}}

-

{{t 'onboarding.success.descriptions.controller'}}

-
- - {{this.model.origin}} - -
-
- -
- -
+
+