Skip to content

Commit

Permalink
Merge pull request #403 from code4romania/fix-add-user
Browse files Browse the repository at this point in the history
Fix add user
  • Loading branch information
gheorghelupu17 authored Dec 11, 2024
2 parents 97f6406 + 83ea9e2 commit 2589466
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/Filament/Organizations/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public static function getSchema(): array
CheckboxList::make('case_permissions')
->label(__('user.labels.case_permissions'))
->options(CasePermission::getOptionsWithoutCaseManager())
->disableOptionWhen(function (Get $get, string $value, OrganizationUserPermissions $record) {
if ($record->user->isNgoAdmin()) {
->disableOptionWhen(function (Get $get, string $value, ?OrganizationUserPermissions $record) {
if ($record?->user->isNgoAdmin()) {
return true;
}

Expand All @@ -202,8 +202,8 @@ public static function getSchema(): array
CheckboxList::make('admin_permissions')
->label(__('user.labels.admin_permissions'))
->options(AdminPermission::options())
->disableOptionWhen(function (Get $get, string $value, OrganizationUserPermissions $record) {
if ($record->user->isNgoAdmin()) {
->disableOptionWhen(function (Get $get, string $value, ?OrganizationUserPermissions $record) {
if ($record?->user->isNgoAdmin()) {
return true;
}

Expand All @@ -230,11 +230,11 @@ public static function getSchema(): array

public static function setDefaultCaseAndNgoAdminPermissions(): \Closure
{
return function (Set $set, Get $get, $state, User $record) {
return function (Set $set, Get $get, $state, ?User $record) {
$casePermissions = $get('permissions.case_permissions') ?: [];
$adminPermissions = $get('permissions.admin_permissions') ?: [];

if ($record->isNgoAdmin()) {
if ($record?->isNgoAdmin()) {
$casePermissions = CasePermission::values();
$adminPermissions = AdminPermission::values();

Expand Down

0 comments on commit 2589466

Please sign in to comment.