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

Allow Publishing Managers to manage their apps #2370

Merged
merged 8 commits into from
Sep 28, 2023

Commits on Sep 28, 2023

  1. Use redirect_back_or_to in user_not_authorized

    If the user attempts to do something they're not authorized to do then
    we should first try to take them back to the page they were on, and only
    redirect to the root path as a fallback. Ideally users wouldn't be able
    to use the UI to navigate to actions they're not authorized to execute
    but this small change will make the experience slightly better if they
    are able to.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    db3607b View commit details
    Browse the repository at this point in the history
  2. Use govuk-link class in "View permissions" link

    Calum spotted that I'd missed this.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    abc6989 View commit details
    Browse the repository at this point in the history
  3. Improve display of permissions table

    To avoid the column widths varying based on the length of text in the
    (permission) Name column.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    daa545c View commit details
    Browse the repository at this point in the history
  4. Namespace the ApplicationPolicy

    In order to allow Publishing Managers to remove their own signin
    permission from apps I'm going to need an instance of the Application so
    that I can check whether it has delegatable permissions.
    
    This preparatory change will allow me to pass an instance of Application
    to `authorize` in order to automagically find this
    `Account::ApplicationPolicy` class.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    02b87fe View commit details
    Browse the repository at this point in the history
  5. Move permission from UserPolicy to ApplicationPolicy

    In preparation for allowing Publishing Managers to use the
    /account/applications page.
    
    Publishing Managers can only remove their signin permission from an
    application if the application has delegatable permissions, so we need
    an instance of Application to check whether the user is authorized to
    remove their access.
    
    I've chosen to move all permission related methods over to keep them
    together.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    b6c3b14 View commit details
    Browse the repository at this point in the history
  6. Allow Publishing Managers to use /account/applications

    Publishing Managers can:
    
    - View permissions for all applications they have access to
    - Remove their access from applications with delegatable permissions
    
    Publishing Managers cannot:
    
    - Grant themselves access to applications
    - Remove their access from applications that don't have delegatable
    permissions
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    a6d89dd View commit details
    Browse the repository at this point in the history
  7. Don't display "Grant access" button to Publishing Managers

    Publishing Managers aren't allowed to grant themselves access to
    applications so we shouldn't show them this button.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    defd389 View commit details
    Browse the repository at this point in the history
  8. Conditionally display the "Remove access" button

    Publishing Managers can only remove their access from applications that
    have delegatable permissions. We should only display the button if
    they're allowed to remove their access.
    chrisroos committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    036a2ee View commit details
    Browse the repository at this point in the history