module HelixVersioningEngine # Methods to manipulate protections table. # # The 'protections' resource in our system is the complete list, so you don't # fetch or manipulate any single 'protection'. It's all or nothing. class App < Sinatra::Base # Just list all protections get '/helix_versioning_engine/:api/protections' do |_| require_p4 p4 = env['p4'] protects = p4.run_protect('-o').first protects.to_json end # Update protections put '/helix_versioning_engine/:api/protections' do |_| protects = { 'Protections' => params['Protections'] } require_p4 p4 = env['p4'] p4.input = protects r = p4.run_protect('-i') r.nil? ? '' : r.to_json end end end