User core for nette framework

v1.0.4 2021-09-02 12:59 UTC

This package is auto-updated.

Last update: 2024-11-29 06:22:36 UTC


README

Latest Stable Version Total Downloads Integrity check Latest Unstable Version License

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