mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-12 16:44:08 -08:00
Added comments to SnipePermissionsPolicy for clarity
This commit is contained in:
parent
defed52caa
commit
a65ea639ed
|
@ -5,9 +5,31 @@ use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SnipePermissionsPolicy provides methods for handling the granular permissions used throughout Snipe-IT.
|
||||||
|
* Each "area" of a permission (which is usually a model, like Assets, Departments, etc), has a setting
|
||||||
|
* in config/permissions.php like view/create/edit/delete (and sometimes some extra stuff like
|
||||||
|
* checkout/checkin, etc.)
|
||||||
|
*
|
||||||
|
* A Policy should exist for each of these models, however if they only use the standard view/create/edit/delete,
|
||||||
|
* the policy can be pretty simple, for example with just one method setting the column name:
|
||||||
|
*
|
||||||
|
* protected function columnName()
|
||||||
|
* {
|
||||||
|
* return 'manufacturers';
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
abstract class SnipePermissionsPolicy
|
abstract class SnipePermissionsPolicy
|
||||||
{
|
{
|
||||||
// This should return the key of the model in the users json permission string.
|
/**
|
||||||
|
* This should return the key of the model in the users json permission string.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
abstract protected function columnName();
|
abstract protected function columnName();
|
||||||
|
|
||||||
use HandlesAuthorization;
|
use HandlesAuthorization;
|
||||||
|
|
Loading…
Reference in a new issue