Fixes for policies

This commit is contained in:
David Bomba 2022-10-19 09:33:00 +11:00
parent b72222c3c7
commit c1ac1647f6

View File

@ -49,8 +49,8 @@ class EntityPolicy
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|| ($user->hasPermission('edit_'.strtolower(\Illuminate\Support\Str::snake(class_basename($entity)))) && $entity->company_id == $user->companyId())
|| ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId())
|| $user->owns($entity)
|| $user->assigned($entity);
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
}
/**
@ -66,7 +66,7 @@ class EntityPolicy
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|| ($user->hasPermission('view_'.strtolower(\Illuminate\Support\Str::snake(class_basename($entity)))) && $entity->company_id == $user->companyId())
|| ($user->hasPermission('view_all') && $entity->company_id == $user->companyId())
|| $user->owns($entity)
|| $user->assigned($entity);
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
}
}