diff --git a/addons/auth_oauth/__init__.py b/addons/auth_oauth/__init__.py index 68bb6c79406..62ec900cba2 100644 --- a/addons/auth_oauth/__init__.py +++ b/addons/auth_oauth/__init__.py @@ -1,2 +1,3 @@ import controllers import res_users +import oauth_providers diff --git a/addons/auth_oauth/__openerp__.py b/addons/auth_oauth/__openerp__.py index 68f4d2ccd87..3557bec951b 100644 --- a/addons/auth_oauth/__openerp__.py +++ b/addons/auth_oauth/__openerp__.py @@ -31,6 +31,9 @@ 'depends': ['base', 'web'], 'data': [ ], + 'update_xml': [ + 'oauth_providers.xml' + ], 'js': [ 'static/src/js/auth_oauth.js', ], diff --git a/addons/auth_oauth/oauth_providers.py b/addons/auth_oauth/oauth_providers.py new file mode 100644 index 00000000000..5b5c32841d9 --- /dev/null +++ b/addons/auth_oauth/oauth_providers.py @@ -0,0 +1,26 @@ +from openerp.osv import osv, fields + +class oauth_providers(osv.osv): + + """Class defining the configuration values of an OAuth2 provider""" + + _name = 'oauth.providers' + _description = 'OAuth2 provider' + _order = 'name' + + _columns = { + 'name' : fields.char('Provider name', required=True), # Name of the OAuth2 entity, Google, LinkedIn, etc + 'client_id' : fields.char('Client ID', required=True), # Our identifier + 'auth_endpoint' : fields.char('Authentication URL', required=True), # OAuth provider URL to authenticate users + 'scope' : fields.char('Accessed user data'), # OAUth user data desired to access + 'validation_endpoint' : fields.char('Validation URL'), # OAuth provider URL to validate tokens + 'icon_url' : fields.char('Icon'), # URL of the icon's provider + 'active' : fields.boolean('Active'), + 'sequence' : fields.integer(), + } + + _sql_constraints = [ + ('name', 'unique(name)', 'The name of the OAuth provider must be unique') + ] + +oauth_providers() \ No newline at end of file diff --git a/addons/auth_oauth/oauth_providers.xml b/addons/auth_oauth/oauth_providers.xml new file mode 100644 index 00000000000..384a3052789 --- /dev/null +++ b/addons/auth_oauth/oauth_providers.xml @@ -0,0 +1,49 @@ + + + + + + oauth.provider.form + oauth.providers + form + +
+
+ +
+ + + + + + + + + + + + +
+
+
+ + oauth.provider.list + oauth.providers + tree + + + + + + + + + + Providers + oauth.providers + form + tree,form + + +
+
\ No newline at end of file diff --git a/addons/auth_oauth/res_users.py b/addons/auth_oauth/res_users.py index 20771ea4ac6..229eba2f354 100644 --- a/addons/auth_oauth/res_users.py +++ b/addons/auth_oauth/res_users.py @@ -55,7 +55,6 @@ class res_users(osv.Model): r = (cr.dbname, login, oauth_uid) res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)]) - _logger.exception(res) if res: self.write(cr, uid, res[0], {'oauth_access_token':access_token}) else: @@ -63,7 +62,6 @@ class res_users(osv.Model): new_user = { 'name': name, 'login': login, - # 'password': oauth_uid, 'user_email': login, 'oauth_provider': 'Google', 'oauth_uid': oauth_uid,