[FIX] Website_gengo: check API key with SUPERUSER_ID since private_key is really private
This commit is contained in:
parent
64b888669b
commit
8f006ed94e
|
@ -74,7 +74,7 @@ class base_gengo_translations(osv.osv_memory):
|
|||
by the cron) or in a dialog box (if requested by the user), thus it's important to return it
|
||||
translated.
|
||||
'''
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
user = self.pool.get('res.users').browse(cr, 1, uid, context=context)
|
||||
if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key:
|
||||
return (False, _("Gengo `Public Key` or `Private Key` are missing. Enter your Gengo authentication parameters under `Settings > Companies > Gengo Parameters`."))
|
||||
try:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import openerp
|
||||
from openerp import http
|
||||
from openerp import http, SUPERUSER_ID
|
||||
from openerp.http import request
|
||||
import time
|
||||
|
||||
|
@ -20,7 +20,7 @@ class website_gengo(http.Controller):
|
|||
|
||||
@http.route('/website/check_gengo_set', type='json', auth='user', website=True)
|
||||
def check_gengo_set(self):
|
||||
user = request.registry['res.users'].browse(request.cr, request.uid, request.uid)
|
||||
user = request.registry['res.users'].browse(request.cr, SUPERUSER_ID, request.uid)
|
||||
company_flag = 0
|
||||
if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key:
|
||||
company_flag = user.company_id.id
|
||||
|
@ -30,7 +30,7 @@ class website_gengo(http.Controller):
|
|||
def set_gengo_config(self,config):
|
||||
user = request.registry['res.users'].browse(request.cr, request.uid, request.uid)
|
||||
if user.company_id:
|
||||
request.registry['res.company'].write(request.cr, request.uid, user.company_id.id,config)
|
||||
request.registry['res.company'].write(request.cr, request.uid, user.company_id.id, config)
|
||||
return True
|
||||
|
||||
@http.route('/website/post_gengo_jobs', type='json', auth='user', website=True)
|
||||
|
|
Loading…
Reference in New Issue