Permalink
Browse files

Add ability for non-administrator users to view other's scans

  • Loading branch information...
1 parent 488df54 commit 24e33db7c2af08edc0203518be8d83cf42160167 @lattera lattera committed Jan 17, 2012
Showing with 13 additions and 2 deletions.
  1. +3 −0 helpers.inc
  2. +10 −2 vulnscan.module
View
@@ -295,6 +295,9 @@ function list_scans($user, $allusers=false) {
if ($uid[0] == '.')
continue;
+ if ($uid == $user->uid && user_access('view own scans') == false)
+ continue;
+
$u = user_load($uid);
$serversdir = dir($base . '/' . $uid);
View
@@ -95,10 +95,18 @@ function vulnscan_menu() {
'page callback' => 'drupal_get_form',
'page arguments' => array('vulnscan_list_scans_form'),
'file' => 'view.inc',
- 'access callback' => 'user_access',
- 'access arguments' => array('view own scans', 'view others scans'),
+ 'access callback' => 'user_view_perms',
+ 'access arguments' => array(array('view own scans', 'view others scans')),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
+
+function user_view_perms($perms=array()) {
+ foreach ($perms as $perm)
+ if (user_access($perm))
+ return TRUE;
+
+ return FALSE;
+}

0 comments on commit 24e33db

Please sign in to comment.