Restrict care unit and department setup to admins.
Deploy Ladill Care / deploy (push) Successful in 48s

Nurses keep Nursing Services for clinical work but can no longer browse or create structural units and departments.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-20 11:33:38 +00:00
co-authored by Cursor
parent 7c32b34715
commit 82a2b1a9a7
7 changed files with 54 additions and 9 deletions
@@ -156,15 +156,50 @@ class CareMyShiftsAndNavPermissionsTest extends TestCase
public function test_nurse_still_gets_nursing_services_access(): void
{
$user = User::create([
'public_id' => 'nurse-hub',
'name' => 'Ward Nurse',
'email' => 'nurse-hub@example.com',
]);
$member = Member::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'user_ref' => 'nurse-hub',
'user_ref' => $user->public_id,
'role' => 'nurse',
'branch_id' => $this->branch->id,
]);
$permissions = app(CarePermissions::class);
$this->assertTrue($permissions->can($member, 'nursing.services.view'));
$this->assertTrue($permissions->can($member, 'inpatient.placement.view'));
$this->assertFalse($permissions->can($member, 'admin.departments.view'));
$this->assertFalse($permissions->can($member, 'admin.departments.manage'));
$this->actingAs($user)
->get(route('care.care-units.index'))
->assertForbidden();
$this->actingAs($user)
->get(route('care.care-units.create'))
->assertForbidden();
$this->actingAs($user)
->get(route('care.departments.index'))
->assertForbidden();
$this->actingAs($user)
->get(route('care.departments.create'))
->assertForbidden();
$this->actingAs($user)
->get(route('care.nursing.services'))
->assertOk();
$this->actingAs($user)
->get(route('care.dashboard'))
->assertOk()
->assertDontSee('>Care units<', false)
->assertDontSee('>Departments<', false)
->assertSee('>Nursing Services<', false);
}
}