add role checking to controllers
This commit is contained in:
31
console/migrations/m151105_114421_add__role__employee.php
Normal file
31
console/migrations/m151105_114421_add__role__employee.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m151105_114421_add__role__employee extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$role = Yii::$app->authManager->createRole('employee');
|
||||
Yii::$app->authManager->add($role);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m151105_114421_add__role__employee 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