@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import auto_database_backup |
@ -0,0 +1,53 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
import json |
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class OnedriveAuth(http.Controller): |
||||
|
"""Controller for handling authentication with OneDrive and Google Drive.""" |
||||
|
@http.route('/onedrive/authentication', type='http', auth="public") |
||||
|
def oauth2callback(self, **kw): |
||||
|
""" |
||||
|
Callback function for OneDrive authentication. |
||||
|
|
||||
|
:param kw: A dictionary of keyword arguments. |
||||
|
:return: A redirect response. |
||||
|
""" |
||||
|
state = json.loads(kw['state']) |
||||
|
backup_config = request.env['db.backup.configure'].sudo().browse( |
||||
|
state.get('backup_config_id')) |
||||
|
backup_config.get_onedrive_tokens(kw.get('code')) |
||||
|
backup_config.hide_active = True |
||||
|
backup_config.active = True |
||||
|
return http.local_redirect(state.get('url_return')) |
||||
|
|
||||
|
@http.route('/google_drive/authentication', type='http', auth="public") |
||||
|
def gdrive_oauth2callback(self, **kw): |
||||
|
"""Callback function for Google Drive authentication.""" |
||||
|
state = json.loads(kw['state']) |
||||
|
backup_config = request.env['db.backup.configure'].sudo().browse( |
||||
|
state.get('backup_config_id')) |
||||
|
backup_config.get_gdrive_tokens(kw.get('code')) |
||||
|
backup_config.active = True |
||||
|
return http.local_redirect(state.get('url_return')) |
|
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 190 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 283 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 42 KiB |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import dropbox_auth_code |
@ -0,0 +1,59 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
GOOGLE_AUTH_ENDPOINT = 'https://accounts.google.com/o/oauth2/auth' |
||||
|
GOOGLE_TOKEN_ENDPOINT = 'https://accounts.google.com/o/oauth2/token' |
||||
|
|
||||
|
|
||||
|
class AuthenticationWizard(models.TransientModel): |
||||
|
"""Wizard to handle authentication for backup configuration. |
||||
|
This wizard allows users to enter the Dropbox authorization code and |
||||
|
sets up the Dropbox refresh token.""" |
||||
|
_name = 'dropbox.auth.code' |
||||
|
_description = 'Authentication Code Wizard' |
||||
|
|
||||
|
dropbox_authorization_code = fields.Char( |
||||
|
string='Dropbox Authorization Code', |
||||
|
help='The authorization code of dropbox') |
||||
|
dropbox_auth_url = fields.Char(string='Dropbox Authentication URL', |
||||
|
compute='_compute_dropbox_auth_url', |
||||
|
help='Dropbox authentication URL') |
||||
|
|
||||
|
@api.depends('dropbox_authorization_code') |
||||
|
def _compute_dropbox_auth_url(self): |
||||
|
"""Compute method to generate the Dropbox authentication URL based on |
||||
|
the provided authorization code.""" |
||||
|
backup_config = self.env['db.backup.configure'].browse( |
||||
|
self.env.context.get('active_id')) |
||||
|
dropbox_auth_url = backup_config.get_dropbox_auth_url() |
||||
|
for rec in self: |
||||
|
rec.dropbox_auth_url = dropbox_auth_url |
||||
|
|
||||
|
def action_setup_dropbox_token(self): |
||||
|
"""Action method to set up the Dropbox refresh token using the |
||||
|
provided authorization code.""" |
||||
|
backup_config = self.env['db.backup.configure'].browse( |
||||
|
self.env.context.get('active_id')) |
||||
|
backup_config.hide_active = True |
||||
|
backup_config.active = True |
||||
|
backup_config.set_dropbox_refresh_token(self.dropbox_authorization_code) |
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Form view of authentication.wizard--> |
||||
|
<record id="dropbox_auth_code_view_form" model="ir.ui.view"> |
||||
|
<field name="name">dropbox.auth.code.view.form</field> |
||||
|
<field name="model">dropbox.auth.code</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<group invisible="not context.get('dropbox_auth')"> |
||||
|
<span>Get an authorization code and set it in the field |
||||
|
below. |
||||
|
</span> |
||||
|
<field name="dropbox_auth_url" |
||||
|
class="fa fa-arrow-right" |
||||
|
widget="url" |
||||
|
text="Get Authorization Code" |
||||
|
nolabel="1"/> |
||||
|
</group> |
||||
|
<group> |
||||
|
<field name="dropbox_authorization_code" |
||||
|
required="context.get('dropbox_auth')" |
||||
|
invisible="not context.get('dropbox_auth')"/> |
||||
|
</group> |
||||
|
<footer> |
||||
|
<button string="Confirm" type="object" |
||||
|
name="action_setup_dropbox_token" |
||||
|
class="btn-primary" |
||||
|
invisible="not context.get('dropbox_auth')"/> |
||||
|
<button string="Cancel" class="btn-secondary" |
||||
|
special="cancel"/> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |