yaltik_odoo_custom/yaltik_portal_project/security/portal_security.xml

68 lines
2.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Fabien Bourgeois <fabien@yaltik.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/>.
-->
<openerp>
<data noupdate="0">
<!-- delete odoo base rule -->
<delete model="ir.rule" id="portal_project_issue.portal_issue_rule" />
<!-- model for portal user creations and writes -->
<record model="ir.rule" id="yaltik_portal_issue_create_rule">
<field name="name">
Yaltik portal issue rule : create and edit own issues
</field>
<field name="model_id" ref="project_issue.model_project_issue"/>
<field name="domain_force">
['|', '|', ('create_uid', '=', user.id), ('user_id', '=', user.id),
('partner_id', '=', user.partner_id.id)]
</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="False"/>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
<!-- duplicate of basic odoo model, only for read access -->
<record model="ir.rule" id="yaltik_portal_issue_read_rule">
<field name="name">
Yaltik portal issue for read only: public or portal and colleagues
following or followers and following
</field>
<field name="model_id" ref="project_issue.model_project_issue"/>
<field name="domain_force">['|', '|',
('project_id.privacy_visibility', 'in', ['public']),
'&amp;',
('project_id.privacy_visibility', '=', 'portal'),
('message_follower_ids', 'child_of',
[user.partner_id.commercial_partner_id.id]),
'&amp;',
('project_id.privacy_visibility', '=', 'followers'),
('message_follower_ids', 'in', [user.partner_id.id]),
]
</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
</data>
</openerp>