fix for module permissions

This commit is contained in:
Harry Bomrah 2014-12-31 16:33:33 +08:00
parent 343294858e
commit ceca2c58c0
1 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,10 @@ class StoreApiController < ApplicationController
response = {"success" => false} response = {"success" => false}
end end
render :json => response.to_json render :json => response.to_json
bundle_install if response["success"] if response["success"]
bundle_install
give_permissions(params[:module_key])
end
end end
def uninstall_module def uninstall_module
@ -54,6 +57,14 @@ class StoreApiController < ApplicationController
sleep 5 sleep 5
end 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) def download_template(url,name)
dir = File.join(Rails.root,"public","template_cache") dir = File.join(Rails.root,"public","template_cache")
destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules") destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules")