Skip to content

Commit

Permalink
fix controllo permessi per gestione amici. closes #297
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Nov 17, 2024
1 parent c424667 commit b8479e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code/resources/views/booking/editwrap.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@endif
</x-larastrap::tabpane>

@if($user->can('users.subusers'))
@if($user->can('users.subusers', $user->gas))
<x-larastrap::tabpane :label="_i('Prenotazioni per gli Amici')" icon="bi-person-add" :id="sprintf('bookings-friends-%s', sanitizeId($aggregate->id))">
<div class="row">
<div class="col-md-12">
Expand Down
4 changes: 2 additions & 2 deletions code/resources/views/user/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$has_accounting = ($admin_editable || $currentuser->id == $user->id || $currentuser->can('movements.admin', $currentgas) || $currentuser->can('movements.view', $currentgas)) && ($user->isFriend() == false && someoneCan('movements.admin', $user->gas));
$has_stats = $has_accounting;
$has_bookings = ($currentuser->id == $user->id);
$has_friends = $editable && $user->can('users.subusers');
$has_friends = $editable && $user->can('users.subusers', $user->gas);
$has_notifications = $user->isFriend() == false && $editable && ($currentgas->getConfig('notify_all_new_orders') == false);
$friend_admin_buttons = [];
Expand Down Expand Up @@ -182,7 +182,7 @@
{{ _i('Da qui è possibile riassegnare un amico ad un altro utente. Tutti i pagamenti pregressi resteranno addebitati a %s.', $user->parent->printableName()) }}
</p>

<x-larastrap::selectobj :label="_i('Nuovo assegnatario')" name="parent_id" :options="App\User::where('id', '!=', $user->parent_id)->topLevel()->sorted()->get()->filter(fn($u) => $u->can('users.subusers'))" />
<x-larastrap::selectobj :label="_i('Nuovo assegnatario')" name="parent_id" :options="App\User::where('id', '!=', $user->parent_id)->with(['gas'])->topLevel()->sorted()->get()->filter(fn($u) => $u->can('users.subusers', $u->gas))" />
</x-larastrap::mform>
</x-larastrap::accordionitem>
</x-larastrap::accordion>
Expand Down

0 comments on commit b8479e4

Please sign in to comment.