File 0001-Prevent-granting-revoking-tickets-in-simulator-mode-.patch of Package hawk.1584

From 493a7401003fa8f425cbddbc8b0f2e7e83a641fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Mon, 19 Oct 2015 13:47:51 +0200
Subject: [PATCH] Prevent granting/revoking tickets in simulator mode
 (bsc#950630)

---
 hawk/app/controllers/main_controller.rb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hawk/app/controllers/main_controller.rb b/hawk/app/controllers/main_controller.rb
index fd08f00..2ae322d 100644
--- a/hawk/app/controllers/main_controller.rb
+++ b/hawk/app/controllers/main_controller.rb
@@ -163,7 +163,11 @@ class MainController < ApplicationController
   end
 
   def ticket_grant
-    if params[:ticket] && params[:site]
+    if ENV['CIB_shadow']
+      render :status => 400, :json => {
+        :error => _('Use the simulator controls while simulator is active')
+      }
+    elsif params[:ticket] && params[:site]
       invoke "booth", "client", "grant", "-t", params[:ticket], "-s", params[:site]
     else
       render :status => 400, :json => {
@@ -173,7 +177,11 @@ class MainController < ApplicationController
   end
 
   def ticket_revoke
-    if params[:ticket]
+    if ENV['CIB_shadow']
+      render :status => 400, :json => {
+        :error => _('Use the simulator controls while simulator is active')
+      }
+    elsif params[:ticket]
       invoke "booth", "client", "revoke", "-t", params[:ticket]
     else
       render :status => 400, :json => {
-- 
2.6.2

openSUSE Build Service is sponsored by