diff --git a/app/Policies/StorageBoxPolicy.php b/app/Policies/StorageBoxPolicy.php index f1351ce4..0cdd7774 100644 --- a/app/Policies/StorageBoxPolicy.php +++ b/app/Policies/StorageBoxPolicy.php @@ -11,6 +11,16 @@ class StorageBoxPolicy { use HandlesAuthorization; + public function before($user, $ability) + { + if ($user->isAdmin() || $user->hasRole('storage')) { + return true; + } + + // fall through to policy methods + return null; + } + /** * Determine whether the user can view the StorageBox. * @@ -58,11 +68,16 @@ public function delete(User $user, StorageBox $StorageBox) return Auth::user()->isAdmin(); } + public function canViewOld(User $user) + { + return false; + } + public function claim(User $user, StorageBox $StorageBox) { - return Auth::user()->isActive() && Auth::user()->storageBoxes->isEmpty(); + return false; } - + public function release(User $user, StorageBox $StorageBox) { return $user->id == $StorageBox->user_id || Auth::user()->isAdmin(); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 713dcec9..3b331f8e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -755,11 +755,6 @@ parameters: count: 3 path: app/Policies/KeyFobPolicy.php - - - message: "#^Access to an undefined property Illuminate\\\\Contracts\\\\Auth\\\\Authenticatable\\:\\:\\$storageBoxes\\.$#" - count: 1 - path: app/Policies/StorageBoxPolicy.php - - message: "#^If condition is always true\\.$#" count: 1 diff --git a/resources/views/account/partials/signposts/item-storage.blade.php b/resources/views/account/partials/signposts/item-storage.blade.php index c7adcbe0..13e22026 100644 --- a/resources/views/account/partials/signposts/item-storage.blade.php +++ b/resources/views/account/partials/signposts/item-storage.blade.php @@ -1,18 +1,30 @@
Your storage space is: {{ $user->storageBoxes()->count() ? $user->storageBoxes()->first()->location : '(none claimed)' }}
+ @if ($user->storageBoxes()->count() > 0) +Please add a sticker to any items you've stored before 1st July 2025, or your items may be disposed of.
+See signage in the Hackspace storage area for full details.
+Your storage space is: {{ $user->storageBoxes()->count() ? $user->storageBoxes()->first()->location : '(none claimed)' }}
-To claim a storage space, or return your space for somebody else to use, visit the Member's Storage page.
+To relinquish your claimed storage location, visit the Member's Storage page.
- + + @else ++ As of January 2025, storage is managed physically with time-limited stickers. + See signage in the Hackspace storage area for full details. +
+ @endif+ The new storage system went into effect in January 2025, with a + grace period until 1st July 2025. +
+ Items left without stickers after 1st July 2025 will be disposed of. +ID | -Location | -Member | -Message | - @if (Auth::user()->hasRole('storage')) -Admin | - @endif -||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ $box->id }} | -{{ $box->location }} | -- @if($box->isClaimed()) - - {{ $box->user->name }} - - @else - Available - @endif - | -
- @if($box->isClaimed() && !$box->user->active)
- ⚠️ Member left
- @elseif (!$box->isClaimed())
- @if (Auth::user()->online_only)
- ⛔ Not available to be claimed
+ @can('canViewOld', BB\Entities\StorageBox::class)
+
+
+ Previous storage claims+These will no longer be in effect after the July 2025 grace period deadline. +This box and below is only visible to admins and storage managers. +
|