-
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.
- Loading branch information
1 parent
ff1610f
commit 5c5f2cc
Showing
5 changed files
with
144 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
namespace App\Policies; | ||
|
||
use App\User; | ||
use App\Models\Rrule; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
// use Spatie\Permission\Models\Permission; | ||
// Permission::create(['name' => 'View any Rrule']); | ||
// Permission::create(['name' => 'Create a Rrule']); | ||
// Permission::create(['name' => 'Update any Rrule']); | ||
// Permission::create(['name' => 'View any ClassRecord']); | ||
|
||
class RrulePolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
/** | ||
* Determine whether the user can view any rrules. | ||
* | ||
* @param \App\User $user | ||
* @return mixed | ||
*/ | ||
public function viewAny(User $user) | ||
{ | ||
return $user->hasAnyPermission(['View any Rrule']); | ||
} | ||
|
||
/** | ||
* Determine whether the user can view the rrule. | ||
* | ||
* @param \App\User $user | ||
* @param \App\Models\Rrule $rrule | ||
* @return mixed | ||
*/ | ||
public function view(User $user, Rrule $rrule) | ||
{ | ||
return $user->hasAnyPermission(['View any Rrule']); | ||
} | ||
|
||
/** | ||
* Determine whether the user can create rrules. | ||
* | ||
* @param \App\User $user | ||
* @return mixed | ||
*/ | ||
public function create(User $user) | ||
{ | ||
return $user->hasAnyPermission(['Create a Rrule']); | ||
} | ||
|
||
/** | ||
* Determine whether the user can update the rrule. | ||
* | ||
* @param \App\User $user | ||
* @param \App\Models\Rrule $rrule | ||
* @return mixed | ||
*/ | ||
public function update(User $user, Rrule $rrule) | ||
{ | ||
return $user->hasAnyPermission(['Update any Rrule']); | ||
} | ||
|
||
/** | ||
* Determine whether the user can delete the rrule. | ||
* | ||
* @param \App\User $user | ||
* @param \App\Models\Rrule $rrule | ||
* @return mixed | ||
*/ | ||
public function delete(User $user, Rrule $rrule) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can restore the rrule. | ||
* | ||
* @param \App\User $user | ||
* @param \App\Models\Rrule $rrule | ||
* @return mixed | ||
*/ | ||
public function restore(User $user, Rrule $rrule) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can permanently delete the rrule. | ||
* | ||
* @param \App\User $user | ||
* @param \App\Models\Rrule $rrule | ||
* @return mixed | ||
*/ | ||
public function forceDelete(User $user, Rrule $rrule) | ||
{ | ||
// | ||
} | ||
} |
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