diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php
index e13128529cc4fa4ba26d8b3cc0f1d03c4d7bb489..e1b5aac41270d5cc59cebf9caf56f03a55d3cd0a 100644
--- a/include/ajax.tickets.php
+++ b/include/ajax.tickets.php
@@ -178,7 +178,6 @@ class TicketsAjaxAPI extends AjaxController {
     }
 
     function previewTicket ($tid) {
-
         global $thisstaff;
 
         if(!$thisstaff || !($ticket=Ticket::lookup($tid))
@@ -445,6 +444,7 @@ class TicketsAjaxAPI extends AjaxController {
     }
 
     function _userlookup($user, $form, $info) {
+        global $thisstaff;
 
         ob_start();
         include(STAFFINC_DIR . 'templates/user-lookup.tmpl.php');
diff --git a/include/ajax.users.php b/include/ajax.users.php
index d4cb6a94856b82c434742c43465d08a566f1651d..f3b6c247a00fd57dc8379c077c6e07c1c0e084da 100644
--- a/include/ajax.users.php
+++ b/include/ajax.users.php
@@ -254,13 +254,13 @@ class UsersAjaxAPI extends AjaxController {
 
         $info = array();
 
-        if (!$thisstaff->getRole()->hasPerm(User::PERM_CREATE))
-            Http::response(403, 'Permission Denied');
-
         if (!AuthenticationBackend::getSearchDirectories())
             $info['lookup'] = 'local';
 
         if ($_POST) {
+            if (!$thisstaff->getRole()->hasPerm(User::PERM_CREATE))
+                Http::response(403, 'Permission Denied');
+
             $info['title'] = __('Add New User');
             $form = UserForm::getUserForm()->getForm($_POST);
             if (($user = User::fromForm($form)))
diff --git a/include/staff/templates/tickets.tmpl.php b/include/staff/templates/tickets.tmpl.php
index 87cc1f9afba2ba7e85e1520e0a18facc9e73bbe4..7fc45a41afd9328dc2b3300b16b935385e57fa76 100644
--- a/include/staff/templates/tickets.tmpl.php
+++ b/include/staff/templates/tickets.tmpl.php
@@ -31,7 +31,7 @@ $tickets->annotate(array(
     'thread_count' => SqlAggregate::COUNT('thread__entries'),
 ));
 
-$tickets->values('staff_id', 'staff__firstname', 'staff__lastname', 'team__name', 'team_id', 'lock_id', 'lock__staff_id', 'isoverdue', 'status_id', 'status__name', 'status__state', 'number', 'cdata__subject', 'ticket_id', 'source', 'dept_id', 'dept__name', 'user_id', 'user__default_email__address', 'user__name');
+$tickets->values('staff_id', 'staff__firstname', 'staff__lastname', 'team__name', 'team_id', 'lock__lock_id', 'lock__staff_id', 'isoverdue', 'status_id', 'status__name', 'status__state', 'number', 'cdata__subject', 'ticket_id', 'source', 'dept_id', 'dept__name', 'user_id', 'user__default_email__address', 'user__name');
 
 TicketForm::ensureDynamicDataView();
 
@@ -92,7 +92,7 @@ if ($results) { ?>
     $subject_field = TicketForm::objects()->one()->getField('subject');
     foreach($tickets as $T) {
         $flag=null;
-        if ($T['lock_id'] && $T['lock__staff_id'] != $thisstaff->getId())
+        if ($T['lock__lock_id'] && $T['lock__staff_id'] != $thisstaff->getId())
             $flag='locked';
         elseif ($T['isoverdue'])
             $flag='overdue';
diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php
index 4737aaea25e1d0c5b923912c7d9dc1a67c197622..55538502017858db5a38abd5bf04f69e395cc620 100644
--- a/include/staff/templates/user.tmpl.php
+++ b/include/staff/templates/user.tmpl.php
@@ -50,9 +50,13 @@ if ($info['error']) {
 <div id="user_tabs_container">
 <div class="tab_content" id="info-tab">
 <div class="floating-options">
+<?php if ($thisstaff->getRole()->hasPerm(User::PERM_EDIT)) { ?>
     <a href="<?php echo $info['useredit'] ?: '#'; ?>" id="edituser" class="action" title="<?php echo __('Edit'); ?>"><i class="icon-edit"></i></a>
+<?php }
+      if ($thisstaff->getRole()->hasPerm(User::PERM_DIRECTORY)) { ?>
     <a href="users.php?id=<?php echo $user->getId(); ?>" title="<?php
         echo __('Manage User'); ?>" class="action"><i class="icon-share"></i></a>
+<?php } ?>
 </div>
     <table class="custom-info" width="100%">
 <?php foreach ($user->getDynamicData() as $entry) {
@@ -72,10 +76,12 @@ if ($info['error']) {
 
 <?php if ($org) { ?>
 <div class="hidden tab_content" id="org-tab">
+<?php if ($thisstaff->getRole()->hasPerm(User::PERM_DIRECTORY)) { ?>
 <div class="floating-options">
     <a href="orgs.php?id=<?php echo $org->getId(); ?>" title="<?php
     echo __('Manage Organization'); ?>" class="action"><i class="icon-share"></i></a>
 </div>
+<?php } ?>
     <table class="custom-info" width="100%">
 <?php foreach ($org->getDynamicData() as $entry) {
 ?>
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index d16b43523050e3a12e75f73b472954880c42e209..580559cb409784bc1643dfed7b536d591749e8be 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -223,14 +223,16 @@ if($ticket->isOverdue())
                                                 $user->getId(), sprintf(_N('%d Closed Ticket', '%d Closed Tickets', $closed), $closed));
                                     ?>
                                     <li><a href="tickets.php?a=search&uid=<?php echo $ticket->getOwnerId(); ?>"><i class="icon-double-angle-right icon-fixed-width"></i> <?php echo __('All Tickets'); ?></a></li>
+<?php   if ($thisstaff->getRole()->hasPerm(User::PERM_DIRECTORY)) { ?>
                                     <li><a href="users.php?id=<?php echo
                                     $user->getId(); ?>"><i class="icon-user
                                     icon-fixed-width"></i> <?php echo __('Manage User'); ?></a></li>
-<?php if ($user->getOrgId()) { ?>
+<?php       if ($user->getOrgId()) { ?>
                                     <li><a href="orgs.php?id=<?php echo $user->getOrgId(); ?>"><i
                                         class="icon-building icon-fixed-width"></i> <?php
                                         echo __('Manage Organization'); ?></a></li>
-<?php } ?>
+<?php       }
+        } ?>
                                 </ul>
                             </div>
                     <?php
diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php
index 99c52d00e047d6768d9e59c746de86ffab421028..f80ae65941b7cd9a44ef04d9b402872f5a7b3746 100644
--- a/include/staff/tickets.inc.php
+++ b/include/staff/tickets.inc.php
@@ -2,7 +2,7 @@
 $search = SavedSearch::create();
 $tickets = TicketModel::objects();
 $clear_button = false;
-$date_header = $date_col = false;
+$view_all_tickets = $date_header = $date_col = false;
 
 // Figure out REFRESH url — which might not be accurate after posting a
 // response
@@ -69,6 +69,7 @@ case 'search':
         $form = $search->getFormFromSession('advsearch');
         $form->loadState($_SESSION['advsearch']);
         $tickets = $search->mangleQuerySet($tickets, $form);
+        $view_all_tickets = $thisstaff->getRole()->hasPerm(SearchBackend::PERM_EVERYTHING);
         $results_type=__('Advanced Search')
             . '<a class="action-button" href="?clear_filter"><i class="icon-ban-circle"></i> <em>' . __('clear') . '</em></a>';
         break;
@@ -93,7 +94,7 @@ if ($status)
 
 // Impose visibility constraints
 // ------------------------------------------------------------
-if (!$thisstaff->getRole()->hasPerm(SearchBackend::PERM_EVERYTHING)) {
+if (!$view_all_tickets) {
     // -- Open and assigned to me
     $visibility = array(
         new Q(array('status__state'=>'open', 'staff_id' => $thisstaff->getId()))