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 @@
  • -
    +

    📦 Storage space

    -

    Your storage space is: {{ $user->storageBoxes()->count() ? $user->storageBoxes()->first()->location : '(none claimed)' }}

    + @if ($user->storageBoxes()->count() > 0) +
    + Storage is changing (action required) +

    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
  • \ No newline at end of file diff --git a/resources/views/storage_boxes/index.blade.php b/resources/views/storage_boxes/index.blade.php index e3f8b4d7..190e1a1c 100644 --- a/resources/views/storage_boxes/index.blade.php +++ b/resources/views/storage_boxes/index.blade.php @@ -5,6 +5,22 @@ @stop @section('content') + +
    +

    Storage is changing: Add stickers to your items by 1st July 2025

    + +

    + 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. +
    +
    @@ -44,54 +60,61 @@
    - - - - - - - - @if (Auth::user()->hasRole('storage')) - - @endif - - - @foreach ($storageBoxes as $box) - - user && !$box->user->active)class="warning"@elseif(!$box->user)class="success"@endif - > - - - - + + @endforeach +
    IDLocationMemberMessageAdmin
    {{ $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.

    +
    + + + + + + + + @if (Auth::user()->hasRole('storage')) + + @endif + + + @foreach ($storageBoxes as $box) + + user && !$box->user->active)class="warning"@elseif(!$box->user)class="success"@endif + > + + + + + @if (Auth::user()->isAdmin() || Auth::user()->hasRole('storage')) + @endif - - @if (Auth::user()->isAdmin() || Auth::user()->hasRole('storage')) - - @endif - - - @endforeach -
    IDLocationMemberMessageAdmin
    {{ $box->id }}{{ $box->location }} + @if($box->isClaimed()) + + {{ $box->user->name }} + @else - @can('claim', $box) - {!! Form::open(array('method'=>'POST', 'route' => ['storage_boxes_claim.update', $box->id], 'class'=>'navbar-left')) !!} - {!! Form::submit('Claim', array('class'=>'btn btn-default')) !!} - {!! Form::close() !!} - @endcan + Available + @endif + + @if($box->isClaimed() && !$box->user->active) + ⚠️ Member left + @elseif (!$box->isClaimed()) + @if (Auth::user()->online_only) + ⛔ Not available to be claimed + @else + @can('claim', $box) + {!! Form::open(array('method'=>'POST', 'route' => ['storage_boxes_claim.update', $box->id], 'class'=>'navbar-left')) !!} + {!! Form::submit('Claim', array('class'=>'btn btn-default')) !!} + {!! Form::close() !!} + @endcan + @endif @endif + AdminAdmin
    +
    + @endcan @stop