first version

This commit is contained in:
Bastian Allgeier
2019-01-13 23:17:34 +01:00
commit 01277f79f2
595 changed files with 82913 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace Kirby\Cms;
class UserPermissions extends ModelPermissions
{
protected $category = 'users';
public function __construct(Model $model)
{
parent::__construct($model);
// change the scope of the permissions, when the current user is this user
$this->category = $this->user && $this->user->is($model) ? 'user' : 'users';
}
protected function canChangeRole(): bool
{
return $this->model->isLastAdmin() !== true;
}
protected function canDelete(): bool
{
return $this->model->isLastAdmin() !== true;
}
}