Files
2021-09-17 12:41:45 +02:00

34 lines
789 B
PHP

<?php
class Zend_View_Helper_AuthInfo extends Zend_View_Helper_Abstract
{
protected $_authService;
public function authInfo($info = null)
{
if (null === $this->_authService) {
$this->_authService = new App_Service_Auth();
}
if (null === $info) {
return $this;
}
if (false === $this->isLoggedIn()) {
return null;
}
return $this->_authService->getIdentity()->$info;
}
public function isLoggedIn()
{
return $this->_authService->getAuth()->hasIdentity();
}
public function checkPermission($resourceName)
{
if ($this->isLoggedIn()) {
return $this->_authService->checkPermission($resourceName);
}
return false;
}
}