feat: implement Share:Assignment permission and restrict action visibility accordingly
This commit is contained in:
parent
d609e959fb
commit
a932a030ad
@ -19,6 +19,7 @@ protected function setUp(): void
|
||||
parent::setUp();
|
||||
|
||||
$this->label('Bagikan Tugas')
|
||||
->visible(fn () => auth()->user()->can('Share:Assignment'))
|
||||
->icon('heroicon-o-paper-airplane')
|
||||
->color(Color::Fuchsia)
|
||||
->link()
|
||||
|
||||
@ -66,4 +66,9 @@ public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Assignment');
|
||||
}
|
||||
|
||||
public function share(AuthUser $authUser, Assignment $assignment): bool
|
||||
{
|
||||
return $authUser->can('Share:Assignment');
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ public function run(): void
|
||||
"Reorder:Assignment",
|
||||
"Restore:Assignment",
|
||||
"RestoreAny:Assignment",
|
||||
"Share:Assignment",
|
||||
"Update:Assignment",
|
||||
"View:Assignment",
|
||||
"ViewAny:Assignment",
|
||||
@ -186,6 +187,7 @@ public function run(): void
|
||||
"ForceDeleteAny:Assignment",
|
||||
"Restore:Assignment",
|
||||
"RestoreAny:Assignment",
|
||||
"Share:Assignment",
|
||||
"Update:Assignment",
|
||||
"View:Assignment",
|
||||
"ViewAny:Assignment",
|
||||
|
||||
@ -86,7 +86,9 @@ class="flex items-center gap-1.5 text-success-600 dark:text-success-400 font-bol
|
||||
<div
|
||||
class="flex flex-wrap items-center gap-3 px-5 py-4 border-t border-gray-100 dark:border-gray-700 bg-gray-50/50 dark:bg-gray-800/20">
|
||||
{{ ($this->pinAction)(['record' => $card->id]) }}
|
||||
@can('Share:Assignment')
|
||||
{{ ($this->shareAssignmentAction)(['record' => $card->id]) }}
|
||||
@endcan
|
||||
|
||||
@canAny(['Update:Assignment', 'Delete:Assignment'])
|
||||
{{ ($this->editAssignmentAction)(['record' => $card->id]) }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user