Departments
Department and membership routes, who may do what, the Hub screens, and every reason a delete is refused.
A department is a named group of staff, for the whole school or one campus. Departments carry permissions, sign off schemes of work and own subjects, so deleting one is guarded. The staff guide is Manage departments.
Who can do what
| Action | Needs | Notes |
|---|---|---|
| List | list on department | Each row has a member count and canOpen (whether you may read it) |
| Open | read, or be a member | |
| Create | create for that campus, or school-wide when no campus | A staff creator becomes head. The campus can't change later |
| Edit | update | Name and description only |
| Add, change or remove members | manage (adding also needs list on staff in the Hub) | |
| Delete | delete on that department | Being head isn't enough |
A campus department can't be given a school-level permission.
On API staging 6308a8a1 (not on main d0fbb403), DepartmentService.create checks the ceiling when the body includes permissions, and updatePermissions checks it on every replace. A pair the caller does not hold is 403 You can only grant permissions you hold. The rule is on Enforcing access. department.service.ts was read. The test was not run. A merge to staging is not a running deploy.
Members
| Route | Operation id | Does |
|---|---|---|
GET .../departments/:departmentId/members | listDepartmentMembers | Cursor on staffId, scoped to that department. No role filter on the API |
POST .../members | addDepartmentMembers | Adds staff-profile ids, default role member. Each person succeeds or fails alone (already a member, or no such staff); the reply lists success and failed |
PATCH .../members/:staffId | updateDepartmentMember | Sets head, manager or member |
POST .../members/remove | removeDepartmentMembers | Removes several; anyone not a member fails alone |
DELETE .../members/:staffId | removeDepartmentMember | Removes one |
What stops a delete
Permission. delete on the department, or You do not have permission to delete this department.
References, even with no members:
- Subjects still assigned to it.
- It's a signatory slot in a campus's scheme set-up.
- It has signed scheme approvals (permanent).
Members. Anyone other than you still in it: Cannot delete a department that has members. Remove all members first. If you're the only member, your membership goes with it.
A department that passes is hard-deleted.
In the Hub
| Screen | Route | Notes |
|---|---|---|
| School list | /staff-hub/school/departments | Filter by campus or school-wide |
| Campus list | /staff-hub/campus/$campusId/departments | Campus departments first, then school-wide ones (no menu on those) |
| Create | Surface | Warns about a duplicate name but doesn't block it. From a campus page, the campus is fixed |
| Settings tab | Name and description. Scope is shown, not editable | |
| Members tab | Search asks the API; the role filter runs in the browser |
A card you can't open is not a link; its tooltip says "You are not a member of this department".
Two delete buttons that disagree
The card menu disables Delete while the department has members. Delete Department on the settings tab doesn't check, and its copy says it removes "all member associations". The API does not: it refuses while others are members, and the toast shows that refusal.
Some failure toasts drop the API's sentence: creating a department, changing a member's role and removing members. Adding members shows it.