Restrict care unit and department setup to admins.
Deploy Ladill Care / deploy (push) Successful in 48s
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user