-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable checkboxes within resources
- Loading branch information
1 parent
1afb0c2
commit 6cc3cc8
Showing
12 changed files
with
186 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?php | ||
|
||
namespace App\Policies; | ||
|
||
use App\Models\User; | ||
use App\Enums\RoleKey; | ||
use App\Models\DiscordTag; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class DiscordTagPolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
/** | ||
* Determine whether the user can view any models. | ||
* | ||
* @param \App\Models\User $user | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function viewAny(User $user) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can view the model. | ||
* | ||
* @param \App\Models\User $user | ||
* @param \App\Models\DiscordTag $discordTag | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function view(User $user, DiscordTag $discordTag) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can create models. | ||
* | ||
* @param \App\Models\User $user | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function create(User $user) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can update the model. | ||
* | ||
* @param \App\Models\User $user | ||
* @param \App\Models\DiscordTag $discordTag | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function update(User $user, DiscordTag $discordTag) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can delete the model. | ||
* | ||
* @param \App\Models\User $user | ||
* @param \App\Models\DiscordTag $discordTag | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function delete(User $user, DiscordTag $discordTag) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can restore the model. | ||
* | ||
* @param \App\Models\User $user | ||
* @param \App\Models\DiscordTag $discordTag | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function restore(User $user, DiscordTag $discordTag) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
/** | ||
* Determine whether the user can permanently delete the model. | ||
* | ||
* @param \App\Models\User $user | ||
* @param \App\Models\DiscordTag $discordTag | ||
* @return \Illuminate\Auth\Access\Response|bool | ||
*/ | ||
public function forceDelete(User $user, DiscordTag $discordTag) | ||
{ | ||
return in_array($user->role->key, [ | ||
RoleKey::SYSTEM, | ||
RoleKey::NMT, | ||
]); | ||
} | ||
|
||
public function deleteAny() | ||
{ | ||
return false; | ||
} | ||
|
||
public function detachAny() | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters