From 67edb98ee5d2c55e55d8927c0634f2b133db1f2a Mon Sep 17 00:00:00 2001 From: Ivan Office Date: Tue, 3 Dec 2024 23:10:06 +0800 Subject: [PATCH] update oauth server --- ai_saas_client/__manifest__.py | 2 +- ai_saas_client/data/auth_oauth_data.xml | 5 +-- app_saas/__manifest__.py | 5 ++- app_saas/data/auth_oauth_data.xml | 23 ++++++++++ app_saas/data/model_new_demo.xml | 46 -------------------- app_saas/models/__init__.py | 2 + app_saas/models/auth_oauth_provider.py | 14 ++++++ app_saas/views/auth_oauth_provider_views.xml | 13 ++++++ 8 files changed, 58 insertions(+), 52 deletions(-) create mode 100644 app_saas/data/auth_oauth_data.xml delete mode 100644 app_saas/data/model_new_demo.xml create mode 100644 app_saas/models/auth_oauth_provider.py create mode 100644 app_saas/views/auth_oauth_provider_views.xml diff --git a/ai_saas_client/__manifest__.py b/ai_saas_client/__manifest__.py index 0b2899fe..3b24fa95 100644 --- a/ai_saas_client/__manifest__.py +++ b/ai_saas_client/__manifest__.py @@ -57,7 +57,7 @@ # 'website', ], 'data': [ - 'data/auth_oauth_data.xml', + # 'data/auth_oauth_data.xml', ], 'assets': { 'web.assets_frontend': [ diff --git a/ai_saas_client/data/auth_oauth_data.xml b/ai_saas_client/data/auth_oauth_data.xml index 44043234..35ed2803 100644 --- a/ai_saas_client/data/auth_oauth_data.xml +++ b/ai_saas_client/data/auth_oauth_data.xml @@ -3,14 +3,13 @@ Ai Passport of odooai.cn - Ai Passport SSO + Log in with Ai Passport https://www.odooai.cn/oauth/authorize https://www.odooai.cn/oauth/token - profile + odoo,profile https://www.odooai.cn/oauth/profile fa fa-2x fa-fw fa-sign-in text-primary - Log in with Ai Passport diff --git a/app_saas/__manifest__.py b/app_saas/__manifest__.py index ef075292..d35acecc 100644 --- a/app_saas/__manifest__.py +++ b/app_saas/__manifest__.py @@ -52,9 +52,12 @@ ''', 'depends': [ 'app_common', + 'auth_oauth', # 'website', ], 'data': [ + 'data/auth_oauth_data.xml', + 'views/auth_oauth_provider_views.xml', 'views/res_config_settings_views.xml', ], 'assets': { @@ -66,8 +69,6 @@ ], }, 'demo': [ - # 'data/model_new_demo.xml', - # 'views/website_templates.xml', ], # 'pre_init_hook': 'pre_init_hook', # 'post_init_hook': 'post_init_hook', diff --git a/app_saas/data/auth_oauth_data.xml b/app_saas/data/auth_oauth_data.xml new file mode 100644 index 00000000..851af0c7 --- /dev/null +++ b/app_saas/data/auth_oauth_data.xml @@ -0,0 +1,23 @@ + + + + + Ai Passport of odooapp.cn + Ai通行证-Odoo中文应用商店 + https://www.odooapp.cn/oauth/authorize + https://www.odooapp.cn/oauth/token + odoo,profile + https://www.odooapp.cn/oauth/profile + + fa fa-2x fa-fw fa-sign-in text-primary + + + + + + + + + diff --git a/app_saas/data/model_new_demo.xml b/app_saas/data/model_new_demo.xml deleted file mode 100644 index e2eca3bc..00000000 --- a/app_saas/data/model_new_demo.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - demo1 - demo1 - 888 - 2023-09-13 - - 0.5 - draft - - - - demo2 - demo2 - 1600 - 2023-10-03 - - 0.6 - done - - - - demo3 - demo3 - 3000 - 2023-09-16 - - 0.3 - cancel - - - - demo4 - demo4 - 40000 - 2023-10-06 - - 0.99 - draft - - - - \ No newline at end of file diff --git a/app_saas/models/__init__.py b/app_saas/models/__init__.py index ce7ed9e5..158965f8 100644 --- a/app_saas/models/__init__.py +++ b/app_saas/models/__init__.py @@ -2,3 +2,5 @@ # Part of odooAi.cn. See LICENSE file for full copyright and licensing details. from . import res_config_settings +from . import auth_oauth_provider + diff --git a/app_saas/models/auth_oauth_provider.py b/app_saas/models/auth_oauth_provider.py new file mode 100644 index 00000000..062608d1 --- /dev/null +++ b/app_saas/models/auth_oauth_provider.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models, modules, tools, _ + +import base64 +from datetime import timedelta + +class AuthOAuthProvider(models.Model): + + _inherit = 'auth.oauth.provider' + _order = 'sequence, name' + + # 取code的url,主要针对国内的先取code,再拿Token的方式 + code_endpoint = fields.Char(string='Token by Code Endpoint', help='Get Token from Code. Only for Code response type.') diff --git a/app_saas/views/auth_oauth_provider_views.xml b/app_saas/views/auth_oauth_provider_views.xml new file mode 100644 index 00000000..644a8e1b --- /dev/null +++ b/app_saas/views/auth_oauth_provider_views.xml @@ -0,0 +1,13 @@ + + + + app.auth.oauth.provider.form + auth.oauth.provider + + + + + + + +