Commit 3214da20 authored by Joel Alarcón's avatar Joel Alarcón Committed by Francesc Guasch
Browse files

803_check_copy_screenshot: fix: copy_screenshot returns error when th… (#893)

* 803_check_copy_screenshot: fix: copy_screenshot returns error when the machine is a base. issue [#803].

* 803_check_copy_screenshot: fix: domain variable declared. issue #803

* 803_check_copy_screenshot: fix: single machine can only do screenshots. clones can do screenshots and set base screenshot. issue #803.
parent f12f89a1
......@@ -482,13 +482,15 @@ get '/machine/remove_base/(:id).(:type)' => sub {
get '/machine/screenshot/(:id).(:type)' => sub {
my $c = shift;
return access_denied($c) if !$USER->can_screenshot();
my $domain = _search_requested_machine($c);
return access_denied($c) if (!$USER->can_screenshot() || $domain->is_base());
return screenshot_machine($c);
};
get '/machine/copy_screenshot/(:id).(:type)' => sub {
my $c = shift;
return access_denied($c) if !$USER->is_admin();
my $c = shift;
my $domain = _search_requested_machine($c);
return access_denied($c) if (!$USER->is_admin() || $domain->id_base() == NULL );
return copy_screenshot($c);
};
......
......@@ -10,7 +10,7 @@
<button ng-click="screenshot(<%= $domain->id %>, <%= $domain->is_active %>)">
<%=l "Take screenshot" %></button>
</div>
% if ( $USER->is_admin ) {
% if ( $USER->is_admin && (defined $domain->id_base())) {
<div class="col-lg-2">
<button ng-click="copy_screenshot(<%= $domain->id %>, '<%= $domain->file_screenshot %>')">
<%=l 'Set base picture' %></button>
......
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