Abstract Class yeesoft\db\PermissionsMigration

Inheritanceyeesoft\db\PermissionsMigration » yii\db\Migration

This class helps to create migrations for modules permissions.

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
AUTH_ITEM_CHILD_TABLE '{{%auth_item_child}}' yeesoft\db\PermissionsMigration
AUTH_ITEM_GROUP_TABLE '{{%auth_item_group}}' yeesoft\db\PermissionsMigration
AUTH_ITEM_TABLE '{{%auth_item}}' yeesoft\db\PermissionsMigration
ROLE_ADMIN 'administrator' yeesoft\db\PermissionsMigration
ROLE_AUTHOR 'author' yeesoft\db\PermissionsMigration
ROLE_MODERATOR 'moderator' yeesoft\db\PermissionsMigration
ROLE_USER 'user' yeesoft\db\PermissionsMigration

Method Details

addPermissionsGroup() public method

Creates new permissions group.

public void addPermissionsGroup ( $code, $name )
$code string
$name string
addRole() public method

Creates new role.

public void addRole ( $name, $description )
$name string
$description string
afterDown() public method

Executes after down method.

public mixed afterDown ( )
afterUp() public method

Executes after up method.

public mixed afterUp ( )
beforeDown() public method

Executes before down method.

public mixed beforeDown ( )
beforeUp() public method

Executes before up method.

public mixed beforeUp ( )
deletePermissionsGroup() public method

Deletes permissions group.

public void deletePermissionsGroup ( $code )
$code string
deleteRole() public method

Deletes role.

public void deleteRole ( $name )
$name string
getPermissions() public abstract method

Returns an array of permissions settings.

All items except permissions groups and roles will be created automatically.

Example of settings that may be returned by this method:

'groupCode' => [
  'links' => [
    '/admin/media/*',
    '/admin/media/default/*',
  ],
  'permissionCode' => [
    'title' => 'Permission Title',
    'links' => [
      '/admin/module/*',
      '/admin/module/default/*',
      '/admin/module/default/index',
      '/admin/module/manage/delete'
    ],
    'roles' => [
      'administrator',
      'moderator',
    ],
    'childs' => [
      'child1PermissionCode',
      'child2PermissionCode',
    ],
  ],
]
public abstract void getPermissions ( )
safeDown() public method

public void safeDown ( )
safeUp() public method

public void safeUp ( )