Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Implement new policy SS + modal designs #17749

Merged
merged 35 commits into from
Nov 19, 2022

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented Oct 31, 2022

This PR adds the ability to create an ACL or RGP policy inline when creating a group or entity. It also filters out the root policy from the dropdown.

policies-modal


Example A:

users that can list and read policies but cannot create, will only see a dropdown of existing policies

path "sys/policies*" {
    capabilities = ["read", "list"]
}
path "identity/entity/*" {
  capabilities = ["read", "update", "list", "create"]
}
path "identity/group/*" {
  capabilities = ["read", "update", "list", "create"]
}

Screen Shot 2022-11-01 at 4 35 20 PM


Example B:

user cannot list or create policies, string list input appears

path "sys/policies*" {
    capabilities = ["read"]
}
path "identity/entity/*" {
  capabilities = ["read", "update", "list", "create"]
}
path "identity/group/*" {
  capabilities = ["read", "update", "list", "create"]
}

Screen Shot 2022-11-01 at 4 36 20 PM


Type RGP is disabled unless the user has Sentinel (enterprise feature)

Screen Shot 2022-11-01 at 4 44 51 PM

@hellobontempo hellobontempo marked this pull request as ready for review November 1, 2022 23:08
@hellobontempo hellobontempo added this to the 1.13.0-rc1 milestone Nov 2, 2022
Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I left some comments. It's probably out of the scope of this work but given the complexity of the SearchSelect component I'm surprised that we have somewhat duplicated it for the modal version. It would be great if we could incorporate the modal into the primary component if possible but I'm not familiar with the component and would love to learn more about it.

ui/app/components/identity/edit-form.js Outdated Show resolved Hide resolved
ui/app/components/policy-form.js Outdated Show resolved Hide resolved
ui/app/templates/components/policy-form.hbs Outdated Show resolved Hide resolved
ui/lib/core/addon/components/form-field.hbs Outdated Show resolved Hide resolved
ui/lib/core/addon/components/search-select-with-modal.hbs Outdated Show resolved Hide resolved
ui/tests/acceptance/policies-acl-old-test.js Outdated Show resolved Hide resolved
@@ -42,6 +42,23 @@ import { dasherize } from 'vault/helpers/dasherize';
*/

export default class FormFieldComponent extends Component {
// alphabetical list of all editTypes if they hide <FormFieldLabel>
shouldHideLabel = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about feedback here. Having this object felt like a nice, concise way to document the list of different edit types and quickly reference whether or not they render a <FormFieldLabel>.

But if this feels overly complicated I can refactor to more similarly mimic the template's original conditional

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I wonder if we could iterate on this in the future and export it somewhere and then consume the different types in models as well?

Copy link
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wowza, great work on this! A few more things to address, although none are major. I'll play around with the branch and then approve if it looks good from there

ui/app/components/policy-form.js Outdated Show resolved Hide resolved
ui/app/components/policy-form.js Outdated Show resolved Hide resolved
ui/app/components/policy-form.js Outdated Show resolved Hide resolved
ui/lib/core/addon/components/form-field.js Outdated Show resolved Hide resolved
ui/lib/core/addon/components/search-select-with-modal.js Outdated Show resolved Hide resolved
ui/lib/core/addon/components/search-select-with-modal.js Outdated Show resolved Hide resolved
handleChange() {
if (this.selectedOptions.length && typeof this.selectedOptions.firstObject === 'object') {
if (this.passObject) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand we might not need this in the modal version, but at some point we had to be able know in the parent whether the user picked a new item, so that we could show the form inline. Maybe in a future where the two components are merged, we can only show forms in a modal? 🤩

ui/lib/core/addon/components/search-select-with-modal.js Outdated Show resolved Hide resolved
Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

ui/app/components/policy-form.js Outdated Show resolved Hide resolved
@@ -42,6 +42,23 @@ import { dasherize } from 'vault/helpers/dasherize';
*/

export default class FormFieldComponent extends Component {
// alphabetical list of all editTypes if they hide <FormFieldLabel>
shouldHideLabel = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I wonder if we could iterate on this in the future and export it somewhere and then consume the different types in models as well?

ui/lib/core/addon/components/form-field.hbs Show resolved Hide resolved
ui/lib/core/addon/components/search-select-with-modal.hbs Outdated Show resolved Hide resolved
ui/lib/core/addon/components/search-select-with-modal.js Outdated Show resolved Hide resolved
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep Scanner found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭 it's beautiful, let's ship it

Really though, great work on this and loved the collaboration involved!

ui/app/components/modal-form/oidc-assignment-template.js Outdated Show resolved Hide resolved
ui/app/components/policy-form.js Outdated Show resolved Hide resolved
@hellobontempo hellobontempo enabled auto-merge (squash) November 19, 2022 01:15
@hellobontempo hellobontempo merged commit 56a10bb into main Nov 19, 2022
@hellobontempo hellobontempo deleted the ui/VAULT-9447/policy-ss-modal-part-2 branch November 21, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants