diff options
| author | pso (OpenERP) <pso@tinyerp.com> | 2012-09-03 12:25:28 +0530 |
|---|---|---|
| committer | pso (OpenERP) <pso@tinyerp.com> | 2012-09-03 12:25:28 +0530 |
| commit | c8d240afbd5076e3e5b173d5c8d989ebee2e0791 (patch) | |
| tree | 382cb5bb6ff0f22213d7083712164513a81db881 /addons/auth_oauth | |
| parent | e07499a9a228a38a3206378e6617cd4022b12205 (diff) | |
| parent | e3f1c26e6afcf7c3df9bd98166614778e27645ea (diff) | |
[MERGE] Merged with main branch
bzr revid: pso@tinyerp.com-20120903065528-b73t9t63t2iq20sw
Diffstat (limited to 'addons/auth_oauth')
| -rw-r--r-- | addons/auth_oauth/controllers/main.py | 5 | ||||
| -rw-r--r-- | addons/auth_oauth/res_users.py | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index 2959fa45db1..5d939f19db1 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -7,6 +7,7 @@ import werkzeug.utils import openerp.modules.registry import openerp.addons.web.controllers.main import openerp.addons.web.common.http as openerpweb +from openerp import SUPERUSER_ID _logger = logging.getLogger(__name__) @@ -18,7 +19,7 @@ class OAuthController(openerpweb.Controller): registry = openerp.modules.registry.RegistryManager.get(dbname) with registry.cursor() as cr: providers = registry.get('auth.oauth.provider') - l = providers.read(cr, 1, providers.search(cr, 1, [('enabled','=',True)])) + l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled','=',True)])) return l @openerpweb.httprequest @@ -30,7 +31,7 @@ class OAuthController(openerpweb.Controller): with registry.cursor() as cr: try: u = registry.get('res.users') - credentials = u.auth_oauth(cr, 1, provider, kw) + credentials = u.auth_oauth(cr, SUPERUSER_ID, provider, kw) cr.commit() return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials) except AttributeError: diff --git a/addons/auth_oauth/res_users.py b/addons/auth_oauth/res_users.py index 3dbab849942..b4f62612746 100644 --- a/addons/auth_oauth/res_users.py +++ b/addons/auth_oauth/res_users.py @@ -6,6 +6,7 @@ import simplejson import openerp from openerp.osv import osv, fields +from openerp import SUPERUSER_ID _logger = logging.getLogger(__name__) @@ -63,7 +64,7 @@ class res_users(osv.Model): try: return super(res_users, self).check_credentials(cr, uid, password) except openerp.exceptions.AccessDenied: - res = self.search(cr, 1, [('id','=',uid),('oauth_access_token','=',password)]) + res = self.search(cr, SUPERUSER_ID, [('id','=',uid),('oauth_access_token','=',password)]) if not res: raise |
