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: Restrict the viewing/editing of certain UI elements based on the users ACLs #9687

Merged
merged 12 commits into from
Feb 19, 2021

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Feb 2, 2021

This PR builds on the minimal permission inspection we were using in order to decide whether to show the 'Manage Namespace' menu item for operators.

As we are likely to be doing this kind of thing a lot more often, we've used ember-can and followed the approach used by other products using this addon/functionality.

The user facing impact of this is that we now only show certain main menu items depending on whether you have read access to them or not. For example, if your ACL token doesn't have read access to KV, then we don't show you the KV navigation link in the main navigation.

We've added a very simple acceptance test only here as there are more upcoming tasks related to this which will probably mean us backing some of the work here with ember-data in order to follow the patterns used by the rest of the app, and I felt it would be a good idea to implement another feature related to this first before deciding on whether/how we should do this. Once this is done we'll probably add a little more testing around this also.

@hashicorp-ci
Copy link
Contributor

🤔 Double check that this PR does not require a changelog entry in the .changelog directory. Reference

@hashicorp-ci
Copy link
Contributor

🤔 Double check that this PR does not require a changelog entry in the .changelog directory. Reference

Copy link
Contributor

@kaxcode kaxcode left a comment

Choose a reason for hiding this comment

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

LGTM

John Cowen and others added 3 commits February 19, 2021 15:53
…9706)

* Adds a {{disabled}} modifier that works similar to fieldset

In that you can set it to false on a parent node and all its sub nodes
will be disabled. It has an added improvement that you can then separate
allow children if you want to disable everything apart from one thing.

One caveat here is that it relies on dom twiddling and is therefore
disabling a parent is not currently very reactive and will need some
MutationObserver work to make it fully reactive.

* Reorganize the base ability for reuse and add canWrite

* Add a session ability

* Make the mock-api authorize endpoint less brittle and more configurable

* Tweak intention write ability to include IsEditable

* Add authzing beforeModel hook to let us to configure auth 403s centrally

* Centrally configure abilities for allowing certain endpoints

* Add session inspection and allow easy access of can from permissions

* Implement read/write access based views across KV/Sessions + Intentions

* Show notification depending on item.Session

* Lint

* Only look at path when auto creating nspaced routes

* Conditionally show view or edit words based on permissions

* Add new step so we can control permissions from acceptance tests

* Add tests to assert permissions inspection functionality

* Lint

* Add CONSUL_RESOURCE_*_* to README
* WIP

* Move authorize to the permissions adapter

* Slight cleanup and add Resources everywhere

* Show a login on the 403 error page

* Change to use authorizeBySlug

* Add some words around namespaces and permissions

* Add correct namespace support

* Reorganize authorizeBy things so we can use a slug or set of perms

* Clean up new repo methods, tweak DataLoader to deal with 403's nicer

* Service > Node

* Add some acceptance tests around single item access

* Add configuration 'segmented' so we can mark things that shouldn't request

* Default permissions to []

* Fix up adapter test
@vercel vercel bot temporarily deployed to Preview – consul February 19, 2021 15:56 Inactive
@johncowen johncowen changed the title ui: Move permission inspection to use ember-can ui: Restrict the viewing/editing of certain UI elements based on the users ACLs Feb 19, 2021
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 19, 2021 16:23 Inactive
@vercel vercel bot temporarily deployed to Preview – consul February 19, 2021 16:23 Inactive
@johncowen johncowen merged commit 8263879 into master Feb 19, 2021
@johncowen johncowen deleted the ui/feature/permissions branch February 19, 2021 16:42
@hashicorp-ci
Copy link
Contributor

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/329527.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants