Question

I'm trying to use hybridauth extension in Yii. Without srbac extension is everything fine, problem is that I need to enable access to this module for unauthorized users using it. I've tried setting property alwaysAllowed as stated in srbac guide:

The operations are named as [ModuleId]/[Subdirectory].[ContollerId][Action]

like this:

'alwaysAllowed'=>array( //default: array()
            'SiteLogin','SiteLogout','SiteIndex','SiteAdmin',
            'SiteError', 'SiteContact','hybridauth@controllers.DefaultLogin'),

(my delimiter is @), it doesn't work. I've been debugging it and it seems that the Hybridauth controller (DefaultController) is not recognized as SBaseController in function _extendsSBaseController (modules/srbac/controllers/AuthItemController.php):

if ($cont instanceof SBaseController) {
  return true;
}

My Controller class is extending the SBaseController and it works for controllers which are not in a module, but not for this. I've also tried to directly extend the DefaultController with SBaseController with no luck.

How to set the module to be alwaysAllowed?

Was it helpful?

Solution

I've added hybridauth@DefaultIndex and hybridauth@DefaultCallback to allways allowed list and now it works. The construction of this string can be seen in srbac/Controllers/SBaseController.php in function beforeAction:

$access = $mod . $controller . ucfirst($this->action->id);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top