Closed Faryshta closed 9 years ago
duplicate of #570
Cebe thanks for the link to the discussion. it looks like everyone agrees that activerecord is a better approach. I have a few advancements on this issue, should i submit a patch?
what kind of advancements?
yii\rbac\BaseModel
that checks the configuration on init
to see if the authManager
component is configured to use and DbManager
instance.
Then gii generated models extending the BaseModel
. i want to add a bit or recursive support for things like see all the permissions for a user and all the children/parents of an item but that is still not done.
And rewrite some of the DbManager
classes to use the models instead of queries. I haven't completed this yet but i think i can submit the pull request and keep working till its done or get feedback on what to get better
The branch is up on my git fork.
https://github.com/Faryshta/yii2/compare/yiisoft:master...Faryshta:activeRecordRBAC
I will rewrite the DbManager
class now but I think the models are completed.
You can open a PR when you are done with that. We can discuss it then.
This is more a question than an issue since it works fine by now.
Why does the
yii\rbac\DbManager
class uses yii queries instead ofyii\db\ActiveRecord
models? TheDbManager
handles all the inserts, updates, deletes and selects by creating Query classes instead of using active record models.Is there a reason behind this?
I think it would be easier to extend if RBAC functionality if it used activerecord models.
The hardest part I can think for the models would be the
tableName
method which is configured by theDbManager
but thats easily solved