add rbac roles, and and admin role to admin user
This commit is contained in:
44
console/migrations/m150919_181709_add_basic_roles.php
Normal file
44
console/migrations/m150919_181709_add_basic_roles.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150919_181709_add_basic_roles extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$role = Yii::$app->authManager->createRole('developer');
|
||||
Yii::$app->authManager->add($role);
|
||||
|
||||
$role = Yii::$app->authManager->createRole('admin');
|
||||
Yii::$app->authManager->add($role);
|
||||
|
||||
|
||||
$role = Yii::$app->authManager->createRole('group_admin');
|
||||
Yii::$app->authManager->add($role);
|
||||
|
||||
$role = Yii::$app->authManager->createRole('shop_admin');
|
||||
Yii::$app->authManager->add($role);
|
||||
|
||||
$role = Yii::$app->authManager->createRole('receptionist');
|
||||
Yii::$app->authManager->add($role);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150919_181709_add_basic_roles cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user