mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
26 lines
581 B
PHP
26 lines
581 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Policies;
|
||
|
|
||
|
use App\Models\OAuthConnection;
|
||
|
use App\Models\User;
|
||
|
|
||
|
class OAuthConnectionPolicy
|
||
|
{
|
||
|
/**
|
||
|
* Determine whether the user can view the model.
|
||
|
*/
|
||
|
public function view(User $user, OAuthConnection $oauthConnection): bool
|
||
|
{
|
||
|
return $user->id === $oauthConnection->user_id;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Determine whether the user can delete the model.
|
||
|
*/
|
||
|
public function delete(User $user, OAuthConnection $oauthConnection): bool
|
||
|
{
|
||
|
return $user->id === $oauthConnection->user_id && $user->password !== null;
|
||
|
}
|
||
|
}
|