Open tonwi opened 9 years ago
Hi,
If you are about data
directory, than it's easy to fix: you just need to specify your own files in config file.
I mean that you can create your own data
directory, and store there your datas. Config routes must be like: @common/my-data-directory/items.php
or similar.
Good luck!
I noticed the same. Is it possible to switch to DB instead of files? I saw with Yii 2.0.3 there is improvement for DB caching so I guess it's good to move to the db.
@golles Yes, it's possible.
To switch Yii2-Start
to DB
manager, you must follow next steps:
authManager
section you need to switch to DbManager
class.authManager
section.itemFile
, assignmentFile
and ruleFile
.DbManager
tables in your DB
:yii migrate --migrationPath=@yii/rbac/migrations/
README
file.php yii rbac/rbac/init
php yii users/rbac/add
php yii blogs/rbac/add
php yii comments/rbac/add
DB
What about the tables? Are they generated automatically?
Ah yes. Also you need to run migration command after you configure your authManager
.
yii migrate --migrationPath=@yii/rbac/migrations/
I updated instruction. See precedent comment if it's not clear.
Just saw it in the yii repo. Thanks mate!
Setup is so easy. However I wanted to add viewblogs to user and when I save I get this error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`golles`.`yii2_auth_item`, CONSTRAINT `yii2_auth_item_ibfk_1` FOREIGN KEY (`rule_name`) REFERENCES `yii2_auth_rule` (`name`) ON DELETE SET NULL ON UPDATE CASCADE)
Any clue what is going wrong?
maybe you try to add some rule like dependency that not exist?
Проблема в том, что поле ruleName является пустой строкой. Если передавать NULL то все ок. Пока сделал костыль if ($model->ruleName == '') $model->ruleName = null;
перед вставкой в БД
Hi there using Yii2-start as basic template for a new app, I modified RBAC-data (new permissions, new roles etc.) Today's package update (yii2-start-rbac-module) did reset my modifications. Well - that's my own issue; I fixed it by make a copy of my rbac-data....... Question: is there a other possibility to use my own data set? do you have any hint? regards