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
@@ -20,9 +20,11 @@ class CareUnitController extends Controller
public function index(Request $request): View
{
$this->authorizeCareUnitView($request);
$this->authorizeAbility($request, 'admin.departments.view');
$organization = $this->organization($request);
$owner = $this->ownerRef($request);
$member = $this->member($request);
$permissions = app(CarePermissions::class);
$units = CareUnit::owned($owner)
->where('organization_id', $organization->id)
@@ -43,6 +45,7 @@ class CareUnitController extends Controller
'organization' => $organization,
'kinds' => config('care.care_unit_kinds'),
'heroStats' => $heroStats,
'canManage' => $permissions->can($member, 'admin.departments.manage'),
]);
}
@@ -7,6 +7,7 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Branch;
use App\Models\Department;
use App\Services\Care\AuditLogger;
use App\Services\Care\CarePermissions;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
@@ -20,6 +21,8 @@ class DepartmentController extends Controller
$this->authorizeAbility($request, 'admin.departments.view');
$organization = $this->organization($request);
$owner = $this->ownerRef($request);
$member = $this->member($request);
$permissions = app(CarePermissions::class);
$departments = Department::owned($owner)
->whereHas('branch', fn ($q) => $q->where('organization_id', $organization->id))
@@ -38,6 +41,7 @@ class DepartmentController extends Controller
'organization' => $organization,
'types' => config('care.department_types'),
'heroStats' => $heroStats,
'canManage' => $permissions->can($member, 'admin.departments.manage'),
]);
}