Browse Source

[FIX] typo

(lp:c2c-addons/6.1  rev 30)
pull/78/head
unknown 13 years ago
parent
commit
68eb57dce9
  1. 0
      ir_config_parameter_viewer/__init__.py
  2. 20
      ir_config_parameter_viewer/__openerp__.py
  3. 38
      ir_config_parameter_viewer/ir_config_parameter_view.xml
  4. 5
      mail_environment/__init__.py
  5. 21
      mail_environment/__openerp__.py
  6. 20
      mail_environment/env_mail.py
  7. 1
      security_protector/__init__.py
  8. 24
      security_protector/__openerp__.py
  9. 8
      security_protector/data.xml
  10. 47
      security_protector/security_protector.py
  11. 8
      security_protector/security_view.xml
  12. 13
      server_env_base_external_referentials/__init__.py
  13. 14
      server_env_base_external_referentials/__openerp__.py
  14. 23
      server_env_base_external_referentials/base_external_referentials.py

0
ir_config_parameter_viewer/__init__.py

20
ir_config_parameter_viewer/__openerp__.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:

38
ir_config_parameter_viewer/ir_config_parameter_view.xml

@ -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>

5
mail_environment/__init__.py

@ -1 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Author Nicolas Bessi. Copyright Camptocamp SA
##############################################################################
from . import env_mail from . import env_mail

21
mail_environment/__openerp__.py

@ -1,24 +1,8 @@
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Nicolas Bessi
# Copyright 2012 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.
#
# 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/>.
#
# Author Nicolas Bessi. Copyright Camptocamp SA
############################################################################## ##############################################################################
{ {
'name': 'Server env config for mail + fetchmail', 'name': 'Server env config for mail + fetchmail',
'version': '0.1', 'version': '0.1',
@ -55,7 +39,6 @@ password = openerp
""", """,
'author': 'Camptocamp', 'author': 'Camptocamp',
'license': 'AGPL-3',
'website': 'http://openerp.camptocamp.com', 'website': 'http://openerp.camptocamp.com',
'depends': ['mail', 'fetchmail', 'server_environment', 'server_environment_files', 'crm'], 'depends': ['mail', 'fetchmail', 'server_environment', 'server_environment_files', 'crm'],
'init_xml': [], 'init_xml': [],

20
mail_environment/env_mail.py

@ -1,24 +1,8 @@
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Nicolas Bessi
# Copyright 2012 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.
#
# 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/>.
#
# Author Nicolas Bessi. Copyright Camptocamp SA
############################################################################## ##############################################################################
from osv import fields from osv import fields
from osv import osv from osv import osv

1
security_protector/__init__.py

@ -1 +0,0 @@
from . import security_protector

24
security_protector/__openerp__.py

@ -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:

8
security_protector/data.xml

@ -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>

47
security_protector/security_protector.py

@ -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()

8
security_protector/security_view.xml

@ -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>

13
server_env_base_external_referentials/__init__.py

@ -1,20 +1,19 @@
# -*- coding: utf-8 -*- # -*- 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 # 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, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################

14
server_env_base_external_referentials/__openerp__.py

@ -1,20 +1,19 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Guewen Baconnier
# Copyright 2011-2012 Camptocamp SA
# Author Guewen Baconnier. Copyright Camptocamp SA
# #
# This program is free software: you can redistribute it and/or modify # 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, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -24,7 +23,6 @@
"version": "1.0", "version": "1.0",
"depends": ["base", 'server_environment', 'base_external_referentials'], "depends": ["base", 'server_environment', 'base_external_referentials'],
"author": "Camptocamp", "author": "Camptocamp",
'license': 'AGPL-3',
"description": """This module is based on the server_environment module to use files for configuration. "description": """This module is based on the server_environment module to use files for configuration.
Thus we can have a different file for each environment (dev, test, staging, prod). Thus we can have a different file for each environment (dev, test, staging, prod).
This module define the config variables for the base_external_referential module. This module define the config variables for the base_external_referential module.

23
server_env_base_external_referentials/base_external_referentials.py

@ -1,28 +1,25 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Guewen Baconnier
# Copyright 2011-2012 Camptocamp SA
# Author Guewen Baconnier. Copyright Camptocamp SA
# #
# This program is free software: you can redistribute it and/or modify # 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, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from osv import fields, osv from osv import fields, osv
from server_environment import serv_config from server_environment import serv_config
import logging
class external_referential(osv.osv): class external_referential(osv.osv):
@ -34,12 +31,8 @@ class external_referential(osv.osv):
values[referential.id] = {} values[referential.id] = {}
for field_name in field_names: for field_name in field_names:
section_name = '.'.join((self._name.replace('.', '_'), referential.name)) section_name = '.'.join((self._name.replace('.', '_'), referential.name))
try:
value = serv_config.get(section_name, field_name)
values[referential.id].update({field_name: value})
except:
logger = logging.getLogger(__name__)
logger.exception('error trying to read field %s in section %s', field_name, section_name)
value = serv_config.get(section_name, field_name)
values[referential.id].update({field_name: value})
return values return values
_columns = { _columns = {

Loading…
Cancel
Save