Skip to content

Commit

Permalink
Update RbacCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Chepurnoy committed Jan 22, 2015
1 parent 5aba6e7 commit 2ed0435
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions commands/RbacCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function renderArray($array)
*/
public function actionSyncSave()
{
$authItem = (new Query())->select('name, type, description, ruleName, data')->from('AuthItem')->all();
$authItem = (new Query())->select('name, type, description, rule_name, data')->from('AuthItem')->all();
$authItemChild = (new Query())->select('parent, child')->from('AuthItemChild')->all();
$authRule = (new Query())->select('name,data')->from('AuthRule')->all();
file_put_contents($this->authItemConfig, $this->renderArray($authItem));
Expand All @@ -110,7 +110,7 @@ public function actionSyncDeploy()
Yii::$app->db->createCommand()->delete('AuthItem')->execute();
$authItem = require($this->authItemConfig);
$insertAuthItemQuery = $queryBuilder->batchInsert('AuthItem', [
'name', 'type', 'description', 'ruleName', 'data'
'name', 'type', 'description', 'rule_name', 'data'
], $authItem);
Yii::$app->db->createCommand($insertAuthItemQuery)->execute();
}
Expand All @@ -133,7 +133,7 @@ public function actionSyncDeploy()
Yii::$app->db->createCommand($insertAuthRuleQuery)->execute();
}
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS=1;")->execute();
Yii::$app->db->createCommand("DELETE aa FROM `AuthAssignment` aa LEFT JOIN AuthItem ai ON(aa.itemName = ai.name) WHERE ai.name IS NULL;")->execute();
Yii::$app->db->createCommand("DELETE aa FROM `AuthAssignment` aa LEFT JOIN AuthItem ai ON(aa.item_name = ai.name) WHERE ai.name IS NULL;")->execute();
}

}
}

0 comments on commit 2ed0435

Please sign in to comment.