diff options
| author | vta vta@openerp.com <> | 2012-08-14 16:29:04 +0200 |
|---|---|---|
| committer | vta vta@openerp.com <> | 2012-08-14 16:29:04 +0200 |
| commit | 397c67348e6672e81a28021caa6e97162da2ca51 (patch) | |
| tree | d7eb03af554ecb0b280dfc3e16615617a96c8e3a /addons/auth_oauth | |
| parent | 0dd635d60376949cfc750f3dff531aca2a1cec64 (diff) | |
[ADD] Added the oauth providers table and views.
bzr revid: vta@openerp.com-20120814142904-7pjt91gl9ld2vxmf
Diffstat (limited to 'addons/auth_oauth')
| -rw-r--r-- | addons/auth_oauth/__init__.py | 1 | ||||
| -rw-r--r-- | addons/auth_oauth/__openerp__.py | 3 | ||||
| -rw-r--r-- | addons/auth_oauth/oauth_providers.py | 26 | ||||
| -rw-r--r-- | addons/auth_oauth/oauth_providers.xml | 49 | ||||
| -rw-r--r-- | addons/auth_oauth/res_users.py | 2 |
5 files changed, 79 insertions, 2 deletions
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 @@ +<?xml version="1.0"?> +<openerp> + <data> + <menuitem id="menu_oauth_provider" parent="base.menu_administration" name="OAuth2 Settings" action="" sequence="100" /> + <record model="ir.ui.view" id="view_oauth_provider_form"> + <field name="name">oauth.provider.form</field> + <field name="model">oauth.providers</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="arch" version="7.0"> + <header> + + </header> + <sheet> + <group name="info1" string="" col=""> + <field name="name" /> + <field name="client_id" /> + <field name="active" /> + </group> + <group name="info2" string="" col=""> + <field name="auth_endpoint" /> + <field name="scope" /> + <field name="validation_endpoint" /> + </group> + </sheet> + </form> + </field> + </record> + <record model="ir.ui.view" id="view_oauth_provider_list"> + <field name="name">oauth.provider.list</field> + <field name="model">oauth.providers</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="arch" version="7.0"> + <field name="name" /> + <field name="client_id" /> + <field name="active" /> + </tree> + </field> + </record> + <record model="ir.actions.act_window" id="action_oauth_provider"> + <field name="name">Providers</field> + <field name="res_model">oauth.providers</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + </record> + <menuitem id="menu_oauth_providers" parent="menu_oauth_provider" name="OAuth2 Providers" action="action_oauth_provider" sequence="0" /> + </data> +</openerp>
\ 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, |
