Use migrations for RBAC tables #2913

Closed
schmunk42 opened this Issue Mar 28, 2014 · 13 comments

Comments

Projects
None yet
7 participants
@schmunk42
Contributor

schmunk42 commented Mar 28, 2014

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

This comment has been minimized.

Show comment
Hide comment
@omnilight

omnilight Mar 29, 2014

Contributor

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

Contributor

omnilight commented Mar 29, 2014

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

@cebe cebe added this to the 2.0 RC milestone Mar 29, 2014

@samdark samdark self-assigned this May 4, 2014

@samdark samdark closed this in 42c5669 May 6, 2014

cebe added a commit that referenced this issue May 6, 2014

Merge branch 'master' of github.com:yiisoft/yii2
* 'master' of github.com:yiisoft/yii2: (43 commits)
  `BaseActiveRecord::findAll()` comment fix
  Fixes #2913: RBAC `DbManager` is now initialized via migration
  [NL] Removed app.php
  [NL] brought translations up to date
  Fix for comparing numeric attributes in JavaScript
  Better Gii caption english
  Fix for comparing numeric attributes in JavaScript
  HHVM compatibility Fixes for Yii 2 Console Application
  Rough creation of a doc style guide
  typo
  Finished Edits
  Edited up to Active Record
  renamed chapter to section [skip ci]
  Catalan translation
  Edited up through "I18N"
  Cleaned Up
  updated guide toc [skip ci]
  Update concept-behaviors.md
  Fixed wrong links [skip ci]
  Fixed document for multisort in BaseArrayHelper
  ...
@paskuale75

This comment has been minimized.

Show comment
Hide comment
@paskuale75

paskuale75 May 8, 2014

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

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

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark May 8, 2014

Member

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

Member

samdark commented May 8, 2014

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

@paskuale75

This comment has been minimized.

Show comment
Hide comment
@paskuale75

paskuale75 May 8, 2014

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

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

@EvansonBarasa

This comment has been minimized.

Show comment
Hide comment
@EvansonBarasa

EvansonBarasa Jan 19, 2015

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

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

@schmunk42

This comment has been minimized.

Show comment
Hide comment
@schmunk42

schmunk42 Jan 19, 2015

Contributor

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

Contributor

schmunk42 commented Jan 19, 2015

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

@EvansonBarasa

This comment has been minimized.

Show comment
Hide comment
@EvansonBarasa

EvansonBarasa Jan 19, 2015

yii_rbac_error
Here is a screen shoot of ./yii help

yii_rbac_error
Here is a screen shoot of ./yii help

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Jan 19, 2015

Member

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

Member

cebe commented Jan 19, 2015

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

@schmunk42

This comment has been minimized.

Show comment
Hide comment
@schmunk42

schmunk42 Jan 19, 2015

Contributor

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

Contributor

schmunk42 commented Jan 19, 2015

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

@lynicidn

This comment has been minimized.

Show comment
Hide comment
@lynicidn

lynicidn Jan 19, 2015

Contributor

@schmunk42 ok :D

Contributor

lynicidn commented Jan 19, 2015

@schmunk42 ok :D

@EvansonBarasa

This comment has been minimized.

Show comment
Hide comment
@EvansonBarasa

EvansonBarasa Jan 20, 2015

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

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

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Jan 20, 2015

Member

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/

Member

samdark commented Jan 20, 2015

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/

@yiisoft yiisoft locked and limited conversation to collaborators Jan 20, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.