3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 03:06:23 +00:00

Fixed maintenance files permission

This commit is contained in:
snipe
2026-07-20 13:59:51 +01:00
parent c6a96474d5
commit de21576035

View File

@ -80,7 +80,7 @@ final class MaintenancePolicy
}
/**
* Determine whether the user can upload or manage files attached to a maintenance record.
* Determine whether the user can view files attached to a maintenance record.
* Allowed if the user can edit the associated asset.
*/
public function files(User $user, Maintenance $maintenance): bool
@ -88,6 +88,18 @@ final class MaintenancePolicy
return Gate::allows('update', $maintenance->asset);
}
/**
* Determine whether the user can upload or delete files attached to a
* maintenance record. Mirrors files() here because maintenance file
* management follows the same asset-edit gate for both read and write.
* MaintenancePolicy is standalone (does not extend SnipePermissionsPolicy)
* so the base class fallback for manageFiles does not apply.
*/
public function manageFiles(User $user, Maintenance $maintenance): bool
{
return Gate::allows('update', $maintenance->asset);
}
/**
* Determine whether the user can view history for a maintenance record.
* Allowed when the user can view the maintenance itself, or has global activity view permission.