Skip to content
Snippets Groups Projects
Commit e3933f0a authored by Peter Rotich's avatar Peter Rotich
Browse files

Check if the user is a collaborator

parent f62c3364
No related branches found
No related tags found
No related merge requests found
...@@ -160,7 +160,6 @@ class Ticket { ...@@ -160,7 +160,6 @@ class Ticket {
} }
function checkUserAccess($user) { function checkUserAccess($user) {
global $cfg;
if (!$user || !($user instanceof EndUser)) if (!$user || !($user instanceof EndUser))
return false; return false;
...@@ -169,9 +168,16 @@ class Ticket { ...@@ -169,9 +168,16 @@ class Ticket {
if ($user->getId() == $this->getUserId()) if ($user->getId() == $this->getUserId())
return true; return true;
//Collaborator //Collaborator?
if (!strcasecmp($user->getRole(), 'collaborator') // 1) If the user was authorized via this ticket.
&& $user->getTicketId() == $this->getId()) if ($user->getTicketId() == $this->getId()
&& !strcasecmp($user->getRole(), 'collaborator'))
return true;
// 2) Query the database to check for expanded access...
if (Collaborator::lookup(array(
'userId' => $user->getId(),
'ticketId' => $this->getId())))
return true; return true;
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment