PDA

View Full Version : Account type


vadderavi
10-17-2008, 12:12 AM
I want to add new account type .basically i need to restrict the user can view only asgined tickets

jpowers40828
10-17-2008, 03:13 PM
That be possible. I've done a little testing with this. This should show only the assigned tickets in the tickets view, and should deny access if trying to view tickets outside of what is assigned to them. You will need to create a group in the admin panel called "Assigned Only". Then make which ever users you would like this to be true with to the group.

In /include/staff/tickets.inc.php ~ line 62

AFTER

//user allowed acess to all departments.
$qwhere =' WHERE 1'; // Brain fart...can not thing of a better way other than selecting all depts + 0 ..wasted query in my book?

ADD

}else if($thisuser->getGroup($thisuser->getId())=="Assigned Only") {
$qwhere =' WHERE ticket.staff_id='.$thisuser->getId();


In /include/class.staff.php ~ line 219

AFTER

function canManageKb() { //kb = knowledge base.
return ($this->isadmin() || $this->udata['can_manage_kb'])?true:false;
}

ADD

function getGroup($id) {
$q = "SELECT group_name FROM ".STAFF_TABLE." LEFT JOIN ".GROUP_TABLE." ON ".STAFF_TABLE.".group_id=".GROUP_TABLE.".group_id WHERE ".STAFF_TABLE.".staff_id=".$id;
$query = mysql_query($q);
$group = mysql_fetch_assoc($query);
return $group['group_name'];
}


In include/staff/viewticket.inc.php ~ line 4

AFTER

if(!$ticket->getId() or (!$thisuser->canAccessDept($ticket->getDeptId()) and $thisuser->getId()!=$ticket->getStaffId())) die('Access Denied');

ADD

if($thisuser->getGroup($thisuser->getId())=="Assigned Only")
if($thisuser->getId()!=$ticket->getStaffId()) die('Access Denied');