PHP Class dektrium\rbac\migrations\Migration

Author: Dmitry Erofeev ([email protected])
Inheritance: extends yii\base\Component, implements yii\db\MigrationInterface
Afficher le fichier Open project: dektrium/yii2-rbac

Méthodes publiques

Свойство Type Description
$authManager The auth manager component ID that this migration should work with.

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Method Details

addChild() protected méthode

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() protected méthode

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

createPermission() protected méthode

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
Résultat yii\rbac\Permission

createRole() protected méthode

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
Résultat yii\rbac\Role

createRule() protected méthode

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
Résultat yii\rbac\Rule

down() public méthode

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
Résultat boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

findItem() protected méthode

Finds either role or permission or throws an exception if it is not found.
protected findItem ( string $name ) : Permission | Role | null
$name string
Résultat yii\rbac\Permission | yii\rbac\Role | null

findPermission() protected méthode

Finds the permission or throws an exception if it is not found.
protected findPermission ( string $name ) : Permission | null
$name string
Résultat yii\rbac\Permission | null

findRole() protected méthode

Finds the role or throws an exception if it is not found.
protected findRole ( string $name ) : Role | null
$name string
Résultat yii\rbac\Role | null

init() public méthode

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

removeItem() protected méthode

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

safeDown() public méthode

This method contains the logic to be executed when removing this migration.
public safeDown ( ) : boolean
Résultat boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

safeUp() public méthode

This method contains the logic to be executed when applying this migration.
public safeUp ( ) : boolean
Résultat boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

up() public méthode

Child classes should not override this method, but use safeUp instead.
public up ( ) : boolean
Résultat boolean return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.

updatePermission() protected méthode

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
Résultat yii\rbac\Permission

updateRole() protected méthode

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
Résultat yii\rbac\Role

updateRule() protected méthode

Updates rule.
protected updateRule ( string $ruleName, string $className ) : Rule
$ruleName string
$className string
Résultat yii\rbac\Rule

Property Details

$authManager public_oe property

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