PHP Класс dektrium\rbac\migrations\Migration

Автор: Dmitry Erofeev ([email protected])
Наследование: extends yii\base\Component, implements yii\db\MigrationInterface
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$authManager The auth manager component ID that this migration should work with.

Открытые методы

Метод Описание
down ( ) : boolean This method contains the logic to be executed when removing this migration.
init ( ) Initializes the migration.
safeDown ( ) : boolean This method contains the logic to be executed when removing this migration.
safeUp ( ) : boolean This method contains the logic to be executed when applying this migration.
up ( ) : boolean This method contains the logic to be executed when applying this migration.

Защищенные методы

Метод Описание
addChild ( Item | string $parent, Item | string $child ) Adds child.
assign ( string | Role $role, string | integer $userId ) Assigns a role to a user.
createPermission ( string $name, string $description = '', string | null $ruleName = null, mixed | null $data = null ) : Permission Creates new permission.
createRole ( string $name, string $description = '', string | null $ruleName = null, mixed | null $data = null ) : Role Creates new role.
createRule ( string $ruleName, string | array $definition ) : Rule Creates new rule.
findItem ( string $name ) : Permission | Role | null Finds either role or permission or throws an exception if it is not found.
findPermission ( string $name ) : Permission | null Finds the permission or throws an exception if it is not found.
findRole ( string $name ) : Role | null Finds the role or throws an exception if it is not found.
removeItem ( string | Item $item ) Removes auth item.
updatePermission ( string | Permission $permission, string $description = '', string $ruleName = null, mixed $data = null ) : Permission Updates permission.
updateRole ( string | Role $role, string $description = '', string $ruleName = null, mixed $data = null ) : Role Updates role.
updateRule ( string $ruleName, string $className ) : Rule Updates rule.

Описание методов

addChild() защищенный Метод

Adds child.
protected addChild ( Item | string $parent, Item | string $child )
$parent yii\rbac\Item | string Either name or Item instance which is parent
$child yii\rbac\Item | string Either name or Item instance which is child

assign() защищенный Метод

Assigns a role to a user.
protected assign ( string | Role $role, string | integer $userId )
$role string | yii\rbac\Role
$userId string | integer

createPermission() защищенный Метод

Creates new permission.
protected createPermission ( string $name, string $description = '', string | null $ruleName = null, mixed | null $data = null ) : Permission
$name string The name of the permission
$description string The description of the permission
$ruleName string | null The rule associated with the permission
$data mixed | null The additional data associated with the permission
Результат yii\rbac\Permission

createRole() защищенный Метод

Creates new role.
protected createRole ( string $name, string $description = '', string | null $ruleName = null, mixed | null $data = null ) : Role
$name string The name of the role
$description string The description of the role
$ruleName string | null The rule associated with the role
$data mixed | null The additional data associated with the role
Результат yii\rbac\Role

createRule() защищенный Метод

Creates new rule.
protected createRule ( string $ruleName, string | array $definition ) : Rule
$ruleName string The name of the rule
$definition string | array The class of the rule
Результат yii\rbac\Rule

down() публичный Метод

The default implementation throws an exception indicating the migration cannot be removed. Child classes should not override this method, but use safeDown instead.
public down ( ) : boolean
Результат boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

findItem() защищенный Метод

Finds either role or permission or throws an exception if it is not found.
protected findItem ( string $name ) : Permission | Role | null
$name string
Результат yii\rbac\Permission | yii\rbac\Role | null

findPermission() защищенный Метод

Finds the permission or throws an exception if it is not found.
protected findPermission ( string $name ) : Permission | null
$name string
Результат yii\rbac\Permission | null

findRole() защищенный Метод

Finds the role or throws an exception if it is not found.
protected findRole ( string $name ) : Role | null
$name string
Результат yii\rbac\Role | null

init() публичный Метод

This method will set [[authManager]] to be the 'authManager' application component, if it is null.
public init ( )

removeItem() защищенный Метод

Removes auth item.
protected removeItem ( string | Item $item )
$item string | yii\rbac\Item Either item name or item instance to be removed.

safeDown() публичный Метод

This method contains the logic to be executed when removing this migration.
public safeDown ( ) : boolean
Результат boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

safeUp() публичный Метод

This method contains the logic to be executed when applying this migration.
public safeUp ( ) : boolean
Результат boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

up() публичный Метод

Child classes should not override this method, but use safeUp instead.
public up ( ) : boolean
Результат boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

updatePermission() защищенный Метод

Updates permission.
protected updatePermission ( string | Permission $permission, string $description = '', string $ruleName = null, mixed $data = null ) : Permission
$permission string | yii\rbac\Permission
$description string
$ruleName string
$data mixed
Результат yii\rbac\Permission

updateRole() защищенный Метод

Updates role.
protected updateRole ( string | Role $role, string $description = '', string $ruleName = null, mixed $data = null ) : Role
$role string | yii\rbac\Role
$description string
$ruleName string
$data mixed
Результат yii\rbac\Role

updateRule() защищенный Метод

Updates rule.
protected updateRule ( string $ruleName, string $className ) : Rule
$ruleName string
$className string
Результат yii\rbac\Rule

Описание свойств

$authManager публичное свойство

The auth manager component ID that this migration should work with.
public $authManager