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

Add a page listing the current user's applications #2334

Merged
merged 6 commits into from
Sep 11, 2023
Merged

Conversation

chrisroos
Copy link
Contributor

@chrisroos chrisroos commented Aug 30, 2023

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.


image

@chrisroos chrisroos force-pushed the add-my-apps-page branch 13 times, most recently from 357d406 to 6c498b7 Compare September 4, 2023 12:59
@chrisroos chrisroos mentioned this pull request Sep 4, 2023
@chrisroos chrisroos force-pushed the add-my-apps-page branch 3 times, most recently from 282c876 to 7c7e735 Compare September 5, 2023 09:13
@chrisroos chrisroos force-pushed the add-my-apps-page branch 7 times, most recently from acabe91 to 2e6f632 Compare September 11, 2023 10:49
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.
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 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
@chrisroos chrisroos marked this pull request as ready for review September 11, 2023 12:12
Copy link
Contributor

@chrislo chrislo left a 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 👍

@chrisroos chrisroos merged commit ab0d550 into main Sep 11, 2023
6 checks passed
@chrisroos chrisroos deleted the add-my-apps-page branch September 11, 2023 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants