passage en cas proxy pour imapunread

This commit is contained in:
2021-07-05 14:07:18 +02:00
parent 3e9e581116
commit d61c2fc94d
6 changed files with 43 additions and 38 deletions

View File

@ -30,7 +30,7 @@ class SecurityController extends Controller
// Init Client CAS
\phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log");
@\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
@\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
\phpCAS::setNoCasServerValidation();
@ -295,4 +295,29 @@ class SecurityController extends Controller
}
}
function imapunreadAction() {
if($this->getParameter("active_imapunread")) {
$ip=$this->getParameter("imapundread_ip");
// Init Client CAS
\phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log");
@\phpCAS::proxy(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
\phpCAS::setNoCasServerValidation();
\phpCAS::forceAuthentication();
$pt= \phpCAS::retrievePT('imap://'.$ip,$t,$f);
$a = \phpCAS::serviceMail("{".$ip.":993/imap/ssl/novalidate-cert}","imap://".$ip,0, $errc,$err,$pt);
$unseen = imap_status($a, "{".$ip.":993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN);
$count=$unseen->unseen;
$response = new Response(json_encode($count));
}
else
$response = new Response(json_encode(""));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
}

View File

@ -10,3 +10,7 @@ cas_sp.test:
path: /test
defaults: { _controller: CadolesCASBundle:Security:test }
cas_sp.imapunread:
path: /imapunread
defaults: { _controller: CadolesCASBundle:Security:imapunread }

View File

@ -973,7 +973,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityItem->addGroup($groupall);
}
$entityItem->setUrl($widroundcube_url);
$entityItem->setBadgeurl("/ninegate/imap-unread.php");
$entityItem->setBadgeurl("/ninegate/cas/imapunread");
$em->persist($entityItem);
}