mati-core / user
User core for nette framework
v1.0.4
2021-09-02 12:59 UTC
Requires
- php: >=8.0
- baraja-core/doctrine: ~3.0
- baraja-core/package-manager: ~2.0
- baraja-core/structured-api: ~2.0
- nette/application: ^3.0
- nette/bootstrap: ^3.0
- nette/di: ^3.0
- nette/neon: ^3.0
- nette/security: ^3.0
- nette/utils: ^3.0
Requires (Dev)
- nette/tester: ~2.0
- phpstan/phpstan: ^0.12
- phpstan/phpstan-nette: ^0.12.6
- tracy/tracy: ^2.3
README
Install
Comoposer command:
composer require mati-core/user
Insert next code in class BasePresenter
/** * @var string */ protected $pageRight = 'cms'; use UserPresenterAccessTrait;
Access control
Check access method:
public function checkAccess(string $rightSlug): bool
Call in presenter
$this->checkAccess('right-slug');
Call in latte
$presenter->checkAccess('right->slug');
Commands
Default init
Create "Super admin" group with full access, "Admin" group with role "Admin" and "cms" right, Super admin account
php www/index.php app:user:init <username> <password>
Create user group
Create user group. If is first user group, then be set as default.
php www/index.php app:usergroup:create <groupname>
Create user
Create user account and associate in default user group.
php www/index.php app:user:create <username> <password>
API
Sign In
Link
/api/v1/sign/sign-in
Params (POST)
function (string $login, string $password): array
Return
loginStatus: bool errorMsg: null|string