Вопрос

I am using zf2 with this two modules (zfc-user, bjyauthorize) and i want to get the user role from my actions

Это было полезно?

Решение

Try this

In your Controller

$viewmodel = new ViewModel();
$authorize = $this->getServiceLocator()->get('BjyAuthorize\Provider\Identity\ProviderInterface');
$roles = $authorize->getIdentityRoles();

$viewmodel->setVariable("roles", $roles);
return $viewmodel;

In your view script

<?php var_dump($this->roles); ?>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top