diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-08-16 04:51:14 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-08-16 04:51:14 +0000 |
| commit | a73c0825a264fc002e7496b07f238f79efd93086 (patch) | |
| tree | 04b170cc3860f82d936b5dcb83451b963c524f95 /indoteknik_api/controllers/controller.py | |
| parent | 3a954e59343d2d3a3df5436297f7007008ae62e8 (diff) | |
| parent | 021f7ccc9f7b026e330352d34e695993116bdd99 (diff) | |
Merged in production (pull request #98)
Production
Diffstat (limited to 'indoteknik_api/controllers/controller.py')
| -rw-r--r-- | indoteknik_api/controllers/controller.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py index 1e9f01ee..d40ccb5a 100644 --- a/indoteknik_api/controllers/controller.py +++ b/indoteknik_api/controllers/controller.py @@ -42,19 +42,10 @@ class Controller(http.Controller): request.session.authenticate(db, username, password) return True except: - try: - authorization = wsgienv['HTTP_AUTHORIZATION'] - except: - authorization = None - request.session.authenticate(config.get('db_name'), 'it@fixcomart.co.id', 'Fixcomart378') - token = request.env['ir.config_parameter'].sudo().get_param('rest_api_token') or '' - result = False - if authorization == token: - result = True + if not request.env.uid: + request.session.authenticate(config.get('db_name'), 'it@fixcomart.co.id', 'Fixcomart378') user_token = self.verify_user_token() - if user_token: - result = user_token - return result + return user_token def user_pricelist(self): user_token = self.authenticate() @@ -147,13 +138,10 @@ class Controller(http.Controller): user = request.env['res.users'].browse([ user_token['id'] ]) if not user: return False - data = { + return { 'user_id': user.id, - 'partner_id': None + 'partner_id': user.partner_id.id or None } - if user.partner_id: - data['partner_id'] = user.partner_id.id - return data except: return False |
