コード例 #1
0
 private function _authorize()
 {
     $acl = Zend_Registry::get('acl');
     $module = $this->_request->getModuleName();
     $controller = $this->_request->getControllerName();
     $action = $this->_request->getActionName();
     $user_roles = $this->_social->getUser()->getRoles();
     $is_authorized = false;
     foreach ($user_roles as $role) {
         if ($acl->isAllowed($role, $module . ':' . $controller, $action)) {
             $is_authorized = true;
             break;
         }
     }
     if (!$is_authorized) {
         $this->_social->handleFailedAuthorization($this->_getRedirectUrlForAuthorization());
     }
 }