Commit 5eb71585 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Fix up call to accesscheck.

parent b483113b
...@@ -24,6 +24,7 @@ use libtblog; ...@@ -24,6 +24,7 @@ use libtblog;
use Node; use Node;
use NodeType; use NodeType;
use Image; use Image;
use User;
use OSinfo; use OSinfo;
use English; use English;
use File::stat; use File::stat;
...@@ -68,6 +69,7 @@ sub osload ($$) { ...@@ -68,6 +69,7 @@ sub osload ($$) {
my $mereuser = 0; my $mereuser = 0;
my $rowref; my $rowref;
my $image; my $image;
my $this_user;
if (!defined($args->{'nodelist'})) { if (!defined($args->{'nodelist'})) {
tberror "Must supply a node list!"; # INTERNAL tberror "Must supply a node list!"; # INTERNAL
...@@ -112,14 +114,19 @@ sub osload ($$) { ...@@ -112,14 +114,19 @@ sub osload ($$) {
# want. Normal users can only change nodes in experiments in their # want. Normal users can only change nodes in experiments in their
# own projects. # own projects.
# #
if ($UID && !TBAdmin($UID)) { if ($UID) {
$mereuser = 1; $this_user = User->ThisUser();
return -1
if (!defined($this_user));
if (! TBNodeAccessCheck($UID, TB_NODEACCESS_LOADIMAGE, @nodes)) { if (!$this_user->IsAdmin()) {
tberror $mereuser = 1;
"Not enough permission to load images on one or ".
"more nodes!"; if (! TBNodeAccessCheck($UID, TB_NODEACCESS_LOADIMAGE, @nodes)) {
return -1; tberror("Not enough permission to load images on one or ".
"more nodes!");
return -1;
}
} }
} }
...@@ -135,7 +142,7 @@ sub osload ($$) { ...@@ -135,7 +142,7 @@ sub osload ($$) {
# Check permission to use the imageid. # Check permission to use the imageid.
# #
if (defined($image) && $mereuser && if (defined($image) && $mereuser &&
! $image->AccessCheck($UID, TB_IMAGEID_READINFO)) { ! $image->AccessCheck($this_user, TB_IMAGEID_READINFO)) {
tberror "You do not have permission to load $image"; tberror "You do not have permission to load $image";
return -1; return -1;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment