From ceca2c58c0b8fd6f4b7044870b5d3dc77bd2bea7 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 31 Dec 2014 16:33:33 +0800 Subject: [PATCH] fix for module permissions --- app/controllers/store_api_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/store_api_controller.rb b/app/controllers/store_api_controller.rb index d35c175..d693539 100644 --- a/app/controllers/store_api_controller.rb +++ b/app/controllers/store_api_controller.rb @@ -30,7 +30,10 @@ class StoreApiController < ApplicationController response = {"success" => false} end render :json => response.to_json - bundle_install if response["success"] + if response["success"] + bundle_install + give_permissions(params[:module_key]) + end end def uninstall_module @@ -54,6 +57,14 @@ class StoreApiController < ApplicationController sleep 5 end + def give_permissions(key) + ma = ModuleApp.find_by_key(key) rescue nil + if !ma.nil? + ma.store_permission_granted = true + ma.save + end + end + def download_template(url,name) dir = File.join(Rails.root,"public","template_cache") destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules")