unknown
13 years ago
14 changed files with 31 additions and 215 deletions
-
0ir_config_parameter_viewer/__init__.py
-
20ir_config_parameter_viewer/__openerp__.py
-
38ir_config_parameter_viewer/ir_config_parameter_view.xml
-
5mail_environment/__init__.py
-
21mail_environment/__openerp__.py
-
20mail_environment/env_mail.py
-
1security_protector/__init__.py
-
24security_protector/__openerp__.py
-
8security_protector/data.xml
-
47security_protector/security_protector.py
-
8security_protector/security_view.xml
-
13server_env_base_external_referentials/__init__.py
-
14server_env_base_external_referentials/__openerp__.py
-
23server_env_base_external_referentials/base_external_referentials.py
@ -1,20 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Author Nicolas Bessi. Copyright Camptocamp SA |
|||
############################################################################## |
|||
{'name': 'Ir.config_parameter view', |
|||
'version': '0.1', |
|||
'category': 'Tools', |
|||
'description': """ |
|||
Create view to inspect/change technical parameters |
|||
""", |
|||
'author': 'Camptocamp', |
|||
'website': 'http://openerp.camptocamp.com', |
|||
'depends': ['base'], |
|||
'init_xml': [], |
|||
'update_xml': ['ir_config_parameter_view.xml'], |
|||
'demo_xml': [], |
|||
'installable': True, |
|||
'auto_install': False} |
|||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
@ -1,38 +0,0 @@ |
|||
<openerp> |
|||
<data> |
|||
<record model="ir.ui.view" id="view_config_list"> |
|||
<field name="name">ir.config_parameter.list</field> |
|||
<field name="model">ir.config_parameter</field> |
|||
<field name="type">tree</field> |
|||
<field name="priority" eval="6"/> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Technical configuration parameters"> |
|||
<field name="key" select="1"/> |
|||
<field name="value" select="1" /> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
<record model="ir.ui.view" id="view_config_form"> |
|||
<field name="name">ir.config_parameter.form</field> |
|||
<field name="model">ir.config_parameter</field> |
|||
<field name="type">form</field> |
|||
<field name="priority" eval="6"/> |
|||
<field name="arch" type="xml"> |
|||
<form string="Technical configuration parameters"> |
|||
<field name="key" select="1"/> |
|||
<field name="value" select="1" /> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<record id="view_config_action" model="ir.actions.act_window"> |
|||
<field name="name">Technical config parameters</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">ir.config_parameter</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_id" ref="view_config_list"/> |
|||
</record> |
|||
|
|||
<menuitem name="Technical config parameters" id="technical_config_parameters" |
|||
parent="base.next_id_15" action="view_config_action" groups="base.group_extended"/> |
|||
</data> |
|||
</openerp> |
@ -1 +1,6 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Author Nicolas Bessi. Copyright Camptocamp SA |
|||
############################################################################## |
|||
from . import env_mail |
@ -1 +0,0 @@ |
|||
from . import security_protector |
@ -1,24 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Author Nicolas Bessi. Copyright Camptocamp SA |
|||
############################################################################## |
|||
{'name': 'Security protector', |
|||
'version': '0.1', |
|||
'category': 'Tools', |
|||
'description': """ |
|||
Prevent security to be changed when module is updated |
|||
This module overwrite ir model acces write delete function. |
|||
Only acces edited trough the UI or with manual_security_override in context set to True will be altered. |
|||
When you try to delete a acces write it simply set all perms to false |
|||
you can deactivate this behavior in ir.config_parameter by chanching the protect_security? key to 0 |
|||
""", |
|||
'author': 'Camptocamp', |
|||
'website': 'http://openerp.camptocamp.com', |
|||
'depends': ['base'], |
|||
'init_xml': ['data.xml'], |
|||
'update_xml': ['security_view.xml'], |
|||
'demo_xml': [], |
|||
'installable': True, |
|||
'auto_install': False} |
|||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
@ -1,8 +0,0 @@ |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="security_protector_config_param" model="ir.config_parameter"> |
|||
<field name="key">protect_security?</field> |
|||
<field name="value">1</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -1,47 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Author Nicolas Bessi. Copyright Camptocamp SA |
|||
############################################################################## |
|||
from osv import fields, osv |
|||
|
|||
class IrModelAccess(osv.osv): |
|||
"We inherit ir model access to add specific write unlink and copy behavior" |
|||
_name = 'ir.model.access' |
|||
_inherit = "ir.model.access" |
|||
|
|||
def _acces_can_be_modified(self, cr, uid, context=None): |
|||
context = context or {} |
|||
on = self.pool.get('ir.config_parameter').get_param(cr, uid, 'protect_security?', default=False, context=context) |
|||
if on in (1, "1", "YES", True): |
|||
if context.get('manual_security_override', False): |
|||
return True |
|||
return False |
|||
|
|||
else: |
|||
return True |
|||
|
|||
def write(self, cr, uid, ids, vals, context=None): |
|||
res =True |
|||
context = context or {} |
|||
if self._acces_can_be_modified(cr, uid, context=context): |
|||
res = super(IrModelAccess, self).write(cr, uid, ids, vals, context=context) |
|||
return res |
|||
|
|||
|
|||
def unlink(self, cr, uid, ids, context=None): |
|||
res = True |
|||
context = context or {} |
|||
# I'm note sur about this one maybe we should do nothing |
|||
if self._acces_can_be_modified(cr, uid, context=context): |
|||
vals = {'perm_read':False, |
|||
'perm_write': False, |
|||
'perm_unlink': False, |
|||
'perm_create': False} |
|||
super(IrModelAccess, self).write(cr, uid, ids, vals, context=context) |
|||
else: |
|||
res = super(IrModelAccess, self).unlink(cr, uid, ids, context=context) |
|||
|
|||
return res |
|||
|
|||
IrModelAccess() |
@ -1,8 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record id="base.ir_access_act" model="ir.actions.act_window"> |
|||
<field name="context">{'manual_security_override': 1}</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -1,20 +1,19 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Author: Guewen Baconnier |
|||
# Copyright 2012 Camptocamp SA |
|||
# Author Guewen Baconnier. Copyright Camptocamp SA |
|||
# |
|||
# 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. |
|||
# it under the terms of the GNU 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. |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# You should have received a copy of the GNU General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue