I created module for admin specific operations. I don't want to write the same access rules for every controller, it's not pretty coding style.
views:
658answers:
3
+1
A:
One solution would be extend a common BaseClass Controller for every class authenticated.
This way you can write once.
Ismael
2009-10-23 10:11:45
Yes, I can, but I think module can contain logic for managing its controllers, otherwise I don't know the sense of module.
YS-PRO
2009-10-23 10:18:48
+1
A:
Module is like a sub-application with separated directory structure. It is not responsible for filtering or checking for permission.
The only vital solution is to define a new abstraction as Ismael proposed.
class ExtendedController
{
public function rules()
{
return array_merge(parent::rules(), array(
// your rules
));
}
}
pestaa
2009-10-23 17:26:19
A:
Ismael and pestaa choices are very good even fast to implement, nevertheless I always recommend more powerful alternatives like RBAC model. You can find a very good GUI for Yii RBAC in http://code.google.com/p/srbac/
robregonm
2009-11-18 18:13:01