-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add a page listing the current user's applications #2334
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrisroos
force-pushed
the
add-my-apps-page
branch
13 times, most recently
from
September 4, 2023 12:59
357d406
to
6c498b7
Compare
Merged
chrisroos
force-pushed
the
add-my-apps-page
branch
3 times, most recently
from
September 5, 2023 09:13
282c876
to
7c7e735
Compare
chrisroos
force-pushed
the
add-my-apps-page
branch
7 times, most recently
from
September 11, 2023 10:49
acabe91
to
2e6f632
Compare
In preparation for nesting various logged-in-user specific pages below it. At present it redirects to either `/users/<current-user-id>/edit` or `/users/<current-user-id>/edit_email_or_password` depending on whether the signed in user has permission to edit their user details.
For consistency with Application.with_signin_delegatable
To remove some duplication.
To remove some duplication.
https://trello.com/c/7Hfe7eu0 The new page is available for the current user at `/account/applications` but isn't yet navigable from the user interface. I'm restricting access to this page to GOV.UK Admins (i.e. superadmins and admins) for now although the plan is to allow Publishing Managers (i.e. super organisation admins and organisation admins) to access it in future. This page will eventually allow users to manage their own permissions for the apps they have access to, and there's some additional complexity around Publishing Managers that I want to defer tackling until later. I'm currently only showing the apps the current user has the signin permission for. This is a subset of apps that a GOV.UK Admin would see when viewing their own edit page at `/users/<id>/edit` because it currently excludes any apps that the user does not have the signin permission for. Note that this can differ from the list of apps shown on a user's dashboard as the dashboard list is additionally restricted to apps where `show_on_dashboard` is `true`[1]. Note that in integration the following apps have `show_on_dashboard` set to `false` (i.e. they won't appear on a user's dashboard but can appear in this new /account/applications page): ``` Doorkeeper::Application.where(show_on_dashboard: false).map(&:name) => ["Content Preview", "Data Publisher", "Special Route Publisher", "Transition (Paas)"] ``` [1]: https://github.com/alphagov/signon/blob/cc4da25cb7da4393d40b64d4cfb0df62c331a563/app/controllers/root_controller.rb#L9
I've extracted `Application.with_signin_permission_for` and `Application.not_retired` from `Application.can_signin` so that I can use it them to list applications that the user doesn't have the signin permission for, and that are not retired.
chrisroos
force-pushed
the
add-my-apps-page
branch
from
September 11, 2023 11:20
2e6f632
to
b567ab9
Compare
chrisroos
changed the title
WIP: Add page for listing a user's applications
Add a page listing the current user's applications
Sep 11, 2023
chrislo
approved these changes
Sep 11, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @chrisroos 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello: https://trello.com/c/7Hfe7eu0
This is the first step toward the new UI for allowing users to manage their own application permissions. It adds a page at
/account/applications
that lists the apps that a user does and doesn't have access to (i.e. those with and without the signin permission). We've chosen not to include retired apps as we don't think it makes sense for a user to be changing their permissions for retired apps.The new applications page is currently only accessible to GOV.UK Admins (superadmins and admins). The intention is to make it available to Publishing Managers too but I'd prefer to get it working for the simpler case before tackling the complexity of Publishing Managers permissions.
Although not strictly necessary I've also chosen to add the
/account
path which currently redirects to either the user's edit page or the user's change email/password page depending on whether the user has permission to access the edit page. I'm imagining that at some point this resource will become a page containing information about the user and allowing them to edit various aspects of their account.