How to create your own permission type in Yii2 (for RBAC)

How to create your own permission type in Yii2 (for RBAC)

To do this, we need the following:

/* ... */
use Yii;
use yiirbacItem;
/* ... */

$auth = Yii::$app -> authManager;

$Item = new Item();
$Item -> type = 3;
$Item -> name = 'ItemNewName'
$Item -> description = 'ItemNewDescription';
$auth -> add($Item);

Where "$Item -> type" specifies a numeric value.

Don’t forget that values 1 and 2 are reserved for roles and permissions.

Are you having problems with your Yii2 framework website? Do you need additional functionality?
>Then write to me via the feedback form, and I will try to help you.

Write a comment

Your email address will not be published. Required fields are marked *