Skip to content

Conversation

@KatieB5
Copy link
Contributor

@KatieB5 KatieB5 commented Jan 21, 2026

Addresses the first two actions of #5473.

Summary of work done

  • Add a new PROJECT_CREATE permission and assign it to the ServiceAdministrator role.
  • Add a “Create a Project” button to the Staff Area Projects page, visible only to users with the PROJECT_CREATE permission.
    • Tthe button uses the same styling as the “Create an Organisation” button on the Staff Area Organisations list page.
    • Tthe button does not yet link anywhere; the ProjectCreate view and form will be implemented in future work.

Testing

  • Added unit and integration tests to check button visibility for users with and without permission.
  • Ran just test-ci
  • Manually tested locally (just run):
    • Assigned myself the ServiceAdministrator role, checked I could see the button on the Staff Area Projects page.
    • Removed the ServiceAdministrator role and checked that I could not see the button.

Screenshot of button
create-a-project-button

@KatieB5 KatieB5 force-pushed the KatieB5/add-create-project-button-to-staff-area-projects-page branch from 5398652 to 57f98cb Compare January 22, 2026 16:49
@KatieB5 KatieB5 changed the title Add new PROJECT_CREATE permission Add "Create a Project" button to Staff Area Projects page Jan 22, 2026
@KatieB5 KatieB5 marked this pull request as ready for review January 22, 2026 17:07
Introduce a new `PROJECT_CREATE` permission and add it to the
ServiceAdministrator role.

This permission will be used to control access to project
creation, including visibility of a "Create project" button
in the Staff Area and access to a project creation form.

The button will be added in a subsequent commit; the form will be made available as part of future work in a separate PR.
This variable allows templates to decide whether to render a
“Create a Project” button on the Staff Area Projects page, based
on the user having the `PROJECT_CREATE` permission.

This approach keeps business logic in the view layer
while the templates can handle the presentation concern.
Add tests asserting that the `ProjectList` view exposes
`can_create_project` as True for users with `PROJECT_CREATE`
and False otherwise.

The authorised test uses a user with both the `ServiceAdministrator` and
`StaffAreaAdministrator` roles, as `ServiceAdministrator` does not have the
`STAFF_AREA_ACCESS` permission required to view the Staff Area Projects
page; we expect to use this role combination in future per team
agreement (https://bennettoxford.slack.com/archives/C069SADHP1Q/p1769013403660589?thread_ts=1768403495.508369&cid=C069SADHP1Q)
Conditionally render a “Create a Project” button on the Staff Area
Projects page when `can_create_project` is true.

Note: The button does not currently link anywhere; a future PR will add
a ProjectCreate view and wire up the navigation.

Also, we ensure the search input value is always defined to avoid
template resolution errors when no query is present.
Verify that the “Create a Project” button is rendered for authorised
users and hidden for unauthorised users on the Staff Area Projects page.

These tests exercise the full request → view → template flow.
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