yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Use migrations for RBAC tables #2913

Closed schmunk42 closed 10 years ago

schmunk42 commented 10 years ago

Would be nice if we could just run something like

./yii migrate/up --migrationPath @yii/rbac

To initialize the needed tables.

The docs should be updated accordingly: http://stuff.cebe.cc/yii2docs/guide-authorization.html#using-db-based-storage-for-rbac

Not of the highest priority, but Yii should use migrations IMHO.

omnilight commented 10 years ago

Currently RBAC tables use tbl_ prefix, that is not always suitable. For example I usually use {{%...} format. Moreover, it could be two or more separated groups of RBAC tables in the single db (one for users in front-end and the second is for backend). So I think that if it would be migrations for RBAC,they have to use some kind of parameters to ask for correct table names

paskuale75 commented 10 years ago

I run first migration (init) then rbac (with migrationPath=..... option) it return me "No new migration found. Your system is up-to-date !!" Why ?

samdark commented 10 years ago

Have you run yii migrate --migrationPath=@yii/rbac/migrations/?

paskuale75 commented 10 years ago

sorry ... I launched yii migrate --migrationPath=vendor/yiisoft/yii2/rbac/migrations
thanks for reply ;)

EvansonBarasa commented 9 years ago

After executing yii rbac/init I get this error Error: Unknown command "rbac/init"!!!!!!!! any help?

schmunk42 commented 9 years ago

@EvansonBarasa Could you show us your output of ./yii help

EvansonBarasa commented 9 years ago

yii_rbac_error Here is a screen shoot of ./yii help

cebe commented 9 years ago

there is no ./yii rbac/init command, where did you get that from?

lynicidn commented 9 years ago

https://github.com/trntv/yii2-starter-kit/#5-initialise-rbac-config ? )))

schmunk42 commented 9 years ago

@lynicidn You should create an issue there, I think.

lynicidn commented 9 years ago

@schmunk42 ok :D

EvansonBarasa commented 9 years ago

@cebe yii rbac/init command from yii 2.0 definitive guide

samdark commented 9 years ago

https://github.com/yiisoft/yii2/blob/master/docs/guide/security-authorization.md#building-authorization-data

@EvansonBarasa this command isn't built-in but the one you should create. Anyway, it's done multiple times w/o issues so it's unlikely that there's an issue with framework itself. If you still have trouble please use official 2.0 forum to get help: http://www.yiiframework.com/forum/index.php/forum/42-general-discussions-for-yii-20/