Skip to content
Snippets Groups Projects
Commit ac13377f authored by Jared Hancock's avatar Jared Hancock
Browse files

Guests cannot see related tickets

parent 00276456
No related branches found
No related tags found
No related merge requests found
...@@ -793,6 +793,7 @@ class AuthTokenAuthentication extends UserAuthenticationBackend { ...@@ -793,6 +793,7 @@ class AuthTokenAuthentication extends UserAuthenticationBackend {
if (!$user || strcmp($this->getAuthKey($user), $authkey)) if (!$user || strcmp($this->getAuthKey($user), $authkey))
return null; return null;
$user->flagGuest();
return $user; return $user;
} }
......
...@@ -18,6 +18,7 @@ abstract class TicketUser { ...@@ -18,6 +18,7 @@ abstract class TicketUser {
static private $token_regex = '/^(?P<type>\w{1})(?P<algo>\d+)x(?P<hash>.*)$/i'; static private $token_regex = '/^(?P<type>\w{1})(?P<algo>\d+)x(?P<hash>.*)$/i';
protected $user; protected $user;
protected $_guest = false;
function __construct($user) { function __construct($user) {
$this->user = $user; $this->user = $user;
...@@ -137,6 +138,14 @@ abstract class TicketUser { ...@@ -137,6 +138,14 @@ abstract class TicketUser {
&& $this->user->getId() == $this->getTicket()->getOwnerId()); && $this->user->getId() == $this->getTicket()->getOwnerId());
} }
function flagGuest() {
$this->_guest = true;
}
function isGuest() {
return $this->_guest;
}
abstract function getTicketId(); abstract function getTicketId();
abstract function getTicket(); abstract function getTicket();
} }
......
...@@ -282,7 +282,7 @@ class UserNav { ...@@ -282,7 +282,7 @@ class UserNav {
$navs['new']=array('desc'=>'Open&nbsp;New&nbsp;Ticket','href'=>'open.php','title'=>''); $navs['new']=array('desc'=>'Open&nbsp;New&nbsp;Ticket','href'=>'open.php','title'=>'');
if($user && $user->isValid()) { if($user && $user->isValid()) {
if($cfg && $cfg->showRelatedTickets()) { if(!$user->isGuest() && $cfg && $cfg->showRelatedTickets()) {
$navs['tickets']=array('desc'=>sprintf('Tickets&nbsp;(%d)',$user->getNumTickets()), $navs['tickets']=array('desc'=>sprintf('Tickets&nbsp;(%d)',$user->getNumTickets()),
'href'=>'tickets.php', 'href'=>'tickets.php',
'title'=>'Show all tickets'); 'title'=>'Show all tickets');
......
...@@ -43,7 +43,8 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); ...@@ -43,7 +43,8 @@ header("Content-Type: text/html; charset=UTF-8\r\n");
style="height: 5em"></a> style="height: 5em"></a>
<p> <p>
<?php <?php
if($thisclient && is_object($thisclient) && $thisclient->isValid()) { if ($thisclient && is_object($thisclient) && $thisclient->isValid()
&& !$thisclient->isGuest()) {
echo Format::htmlchars($thisclient->getName()).'&nbsp;|'; echo Format::htmlchars($thisclient->getName()).'&nbsp;|';
?> ?>
<a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> | <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> |
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
**********************************************************************/ **********************************************************************/
require('secure.inc.php'); require('secure.inc.php');
if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again. if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again.
if ($thisclient->isGuest())
$_REQUEST['id'] = $thisclient->getTicketId();
require_once(INCLUDE_DIR.'class.ticket.php'); require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.json.php'); require_once(INCLUDE_DIR.'class.json.php');
$ticket=null; $ticket=null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment