David Beal
9 years ago
11 changed files with 323 additions and 129 deletions
-
5secure_uninstall/README.md
-
68secure_uninstall/README.rst
-
2secure_uninstall/__init__.py
-
43secure_uninstall/__openerp__.py
-
88secure_uninstall/i18n/fr.po
-
87secure_uninstall/i18n/secure_uninstall.pot
-
1secure_uninstall/models/__init__.py
-
72secure_uninstall/models/module.py
-
86secure_uninstall/module.py
-
0secure_uninstall/static/description/icon.png
-
0secure_uninstall/views/wizard_view.xml
@ -1,5 +0,0 @@ |
|||
Secure Uninstall |
|||
================ |
|||
|
|||
Ask Master Password ('admin_passwd' key from config file) |
|||
before to proceed to module uninstallation |
@ -0,0 +1,68 @@ |
|||
|
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
================ |
|||
Secure Uninstall |
|||
================ |
|||
|
|||
Ask Master Password ('admin_passwd' key from config file) |
|||
before to proceed to module uninstallation |
|||
|
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
Check 'admin_passwd' is set in Odoo configuration file |
|||
|
|||
|
|||
|
|||
Usage |
|||
===== |
|||
|
|||
Try to uninstall a module |
|||
|
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/149/server-tools |
|||
|
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please |
|||
check there if your issue has already been reported. If you spotted it first, |
|||
help us smashing it by providing a detailed and welcomed feedback. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* David Béal <david.beal@akretion.com> |
|||
|
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -1 +1 @@ |
|||
from . import module |
|||
from . import models |
@ -1,50 +1,19 @@ |
|||
# coding: utf-8 |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) All Rights Reserved 2014 Akretion |
|||
# @author David BEAL <david.beal@akretion.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
# Copyright 2014 David BEAL @ Akretion <david.beal@akretion.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
|
|||
{ |
|||
'name': 'Secure Uninstall', |
|||
'version': '0.1', |
|||
'summary': "Ask password to authorize uninstall", |
|||
'version': '8.0.1.0.0', |
|||
'author': "Akretion,Odoo Community Association (OCA)", |
|||
'maintener': 'Akretion', |
|||
'category': 'Base', |
|||
'summary': "Ask password to authorize uninstall", |
|||
'depends': [ |
|||
'base', |
|||
], |
|||
'description': """ |
|||
Secure Uninstall |
|||
================ |
|||
|
|||
Ask Master Password ('admin_passwd' key from config file) |
|||
before to proceed to module uninstallation |
|||
|
|||
|
|||
Contributors |
|||
------------ |
|||
* David BEAL <david.beal@akretion.com> |
|||
|
|||
""", |
|||
'data': ['wizard_view.xml'], |
|||
'data': ['views/wizard_view.xml'], |
|||
'website': 'http://www.akretion.com/', |
|||
'license': 'AGPL-3', |
|||
'tests': [], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,88 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * secure_uninstall |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2016-06-09 09:44+0000\n" |
|||
"PO-Revision-Date: 2016-06-09 11:52+0200\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"Language: fr\n" |
|||
"X-Generator: Poedit 1.8.7.1\n" |
|||
|
|||
#. module: secure_uninstall |
|||
#: help:uninstall.check.wizard,password:0 |
|||
msgid "'admin_passwd' value from Odoo configuration file (aka 'Master Password')" |
|||
msgstr "la valeur 'admin_passwd' du fichier de configuration Odoo (aussi appelé 'Mot de passe Maître')" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Apply" |
|||
msgstr "Appliquer" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Cancel" |
|||
msgstr "Annuler" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Check" |
|||
msgstr "Vérifier" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,create_uid:0 |
|||
msgid "Created by" |
|||
msgstr "Créé par" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,create_date:0 |
|||
msgid "Created on" |
|||
msgstr "Créé le" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,id:0 |
|||
msgid "ID" |
|||
msgstr "ID" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "If you want uninstall module, write required password." |
|||
msgstr "Si vous voulez désinstaller un module, écrivez le mot de passe requis." |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,write_uid:0 |
|||
msgid "Last Updated by" |
|||
msgstr "Mise à jour par" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,write_date:0 |
|||
msgid "Last Updated on" |
|||
msgstr "Mis à jour" |
|||
|
|||
#. module: secure_uninstall |
|||
#: model:ir.model,name:secure_uninstall.model_ir_module_module |
|||
msgid "Module" |
|||
msgstr "Module" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,password:0 |
|||
msgid "Password" |
|||
msgstr "Mot de passe" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Some columns can be dropped and there is no way to recover that except restoring a database backup" |
|||
msgstr "Certaines colonnes peuvent être supprimé et il n'y a aucun moyen de les retrouver excepté en restaurant une sauvegarde de la base de données" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Uninstall module process remove all data managed by the module." |
|||
msgstr "Le processus de désinstallation supprime toutes les données gérées par le module." |
@ -0,0 +1,87 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * secure_uninstall |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2016-06-09 09:44+0000\n" |
|||
"PO-Revision-Date: 2016-06-09 09:44+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: secure_uninstall |
|||
#: help:uninstall.check.wizard,password:0 |
|||
msgid "'admin_passwd' value from Odoo configuration file (aka 'Master Password')" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Apply" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Cancel" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Check" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,create_uid:0 |
|||
msgid "Created by" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,create_date:0 |
|||
msgid "Created on" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,id:0 |
|||
msgid "ID" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "If you want uninstall module, write required password." |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,write_uid:0 |
|||
msgid "Last Updated by" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,write_date:0 |
|||
msgid "Last Updated on" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: model:ir.model,name:secure_uninstall.model_ir_module_module |
|||
msgid "Module" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: field:uninstall.check.wizard,password:0 |
|||
msgid "Password" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Some columns can be dropped and there is no way to recover that except restoring a database backup" |
|||
msgstr "" |
|||
|
|||
#. module: secure_uninstall |
|||
#: view:uninstall.check.wizard:secure_uninstall.view_uninstall_wizard_form |
|||
msgid "Uninstall module process remove all data managed by the module." |
|||
msgstr "" |
|||
|
@ -0,0 +1 @@ |
|||
from . import module |
@ -0,0 +1,72 @@ |
|||
# coding: utf-8 |
|||
# Copyright 2014 David BEAL @ Akretion <david.beal@akretion.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openerp.osv import orm |
|||
from openerp import models, fields, api |
|||
from openerp.exceptions import Warning as UserError |
|||
from openerp.tools.config import config |
|||
|
|||
|
|||
class Module(orm.Model): |
|||
_inherit = 'ir.module.module' |
|||
|
|||
def button_uninstall(self, cr, uid, ids, context=None): |
|||
# can't be convert in new api because use button_uninstall fct |
|||
# in _button_immediate_function() is buggy in new api. |
|||
# Next v10 will solve it. |
|||
if not context: |
|||
context = {} |
|||
if 'uninstall_authorized' in context: |
|||
ctx = context.copy() |
|||
del ctx['uninstall_authorized'] |
|||
super(Module, self).button_uninstall( |
|||
cr, uid, ids, context=ctx) |
|||
return self._button_immediate_function( |
|||
cr, uid, ids, self.button_uninstall, context=ctx) |
|||
else: |
|||
_, view_id = self.pool['ir.model.data'].get_object_reference( |
|||
cr, uid, 'secure_uninstall', 'view_uninstall_wizard_form') |
|||
return { |
|||
'view_id': view_id, |
|||
'view_mode': 'form', |
|||
'res_model': 'uninstall.check.wizard', |
|||
'context': {'module_id': ids[0]}, |
|||
'name': "Uninstall Authorization", |
|||
'type': 'ir.actions.act_window', |
|||
'target': 'new', |
|||
} |
|||
|
|||
|
|||
class UninstallCheckWizard(models.TransientModel): |
|||
_name = 'uninstall.check.wizard' |
|||
|
|||
password = fields.Char( |
|||
string='Password', required=True, |
|||
help="'admin_passwd' value from Odoo configuration file " |
|||
"(aka 'Master Password')") |
|||
|
|||
@api.multi |
|||
def check_password(self): |
|||
for elm in self: |
|||
config_passwd = config.get("admin_passwd") |
|||
if not config_passwd: |
|||
raise UserError( |
|||
"Missing configuration key\n--------------------\n" |
|||
"'admin_passwd' configuration key " |
|||
"(aka 'Master Password') is not set in \n" |
|||
"your Odoo server configuration file: " |
|||
"please set it a value") |
|||
if elm.password != config_passwd: |
|||
raise UserError( |
|||
"Password Error\n--------------------\n" |
|||
"Provided password '%s' doesn't match with " |
|||
"'Master Password'\n('admin_passwd' key) found in the " |
|||
"Odoo server configuration file ." |
|||
"\n\nResolution\n-------------\n" |
|||
"Please check your password and retry or cancel" |
|||
% elm.password) |
|||
module_id = self._context.get('module_id') |
|||
module = self.env['ir.module.module'].browse(module_id) |
|||
module.with_context(uninstall_authorized=True).button_uninstall() |
|||
return True |
@ -1,86 +0,0 @@ |
|||
# coding: utf-8 |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) All Rights Reserved 2014 Akretion |
|||
# @author David BEAL <david.beal@akretion.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
|
|||
from openerp.osv import orm, fields |
|||
from openerp.tools.config import config |
|||
|
|||
|
|||
class Module(orm.Model): |
|||
_inherit = 'ir.module.module' |
|||
|
|||
def button_uninstall(self, cr, uid, ids, context=None): |
|||
if not context: |
|||
context = {} |
|||
if 'uninstall_authorized' in context: |
|||
ctx = context.copy() |
|||
del ctx['uninstall_authorized'] |
|||
super(Module, self).button_uninstall( |
|||
cr, uid, ids, context=ctx) |
|||
return self._button_immediate_function( |
|||
cr, uid, ids, self.button_uninstall, context=ctx) |
|||
else: |
|||
_, view_id = self.pool['ir.model.data'].get_object_reference( |
|||
cr, uid, 'secure_uninstall', 'view_uninstall_wizard_form') |
|||
return { |
|||
'view_id': view_id, |
|||
'view_mode': 'form', |
|||
'res_model': 'uninstall.check.wizard', |
|||
'context': {'module_id': ids[0]}, |
|||
'name': "Uninstall Authorization", |
|||
'type': 'ir.actions.act_window', |
|||
'target': 'new', |
|||
} |
|||
|
|||
|
|||
class UninstallCheckWizard(orm.TransientModel): |
|||
_name = 'uninstall.check.wizard' |
|||
|
|||
_columns = { |
|||
'password': fields.char( |
|||
string='Password', required=True, |
|||
help="'admin_passwd' value from Odoo configuration file " |
|||
"(aka 'Master Password')") |
|||
} |
|||
|
|||
def check_password(self, cr, uid, ids, context=None): |
|||
for elm in self.browse(cr, uid, ids, context=context): |
|||
config_passwd = config.get("admin_passwd") |
|||
if not config_passwd: |
|||
raise orm.except_orm( |
|||
'Missing configuration key', |
|||
"'admin_passwd' configuration key " |
|||
"(aka 'Master Password') is not set in \n" |
|||
"your Odoo server configuration file: " |
|||
"please set it a value") |
|||
if elm.password != config_passwd: |
|||
raise orm.except_orm( |
|||
"Password Error", |
|||
"Issue\n_____\nProvided password '%s' doesn't match with " |
|||
"'Master Password' ('admin_passwd' key) found in the " |
|||
"Odoo server configuration file ." |
|||
"\n\nResolution\n__________\n" |
|||
"Please check your password and retry or cancel" |
|||
% elm.password) |
|||
context['uninstall_authorized'] = True |
|||
module_id = context.get('module_id') |
|||
self.pool['ir.module.module'].button_uninstall( |
|||
cr, uid, [module_id], context=context) |
|||
return True |
Before Width: 171 | Height: 156 | Size: 21 KiB After Width: 171 | Height: 156 | Size: 21 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue