Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] [IMP] payroll: improve security #95

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions payroll/security/hr_payroll_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>
<!-- Allow python editing -->
<record id="group_payroll_allow_python" model="res.groups">
<field name="name">Payroll: Access to python code in salary rules</field>
<field name="category_id" ref="base.module_category_hidden" />
<field name="implied_ids" eval="[(4, ref('payroll.group_payroll_user'))]" />
</record>
<record id="base.default_user" model="res.users">
<field name="groups_id" eval="[(4,ref('payroll.group_payroll_manager'))]" />
</record>
Expand Down
4 changes: 2 additions & 2 deletions payroll/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ access_hr_payslip_input_user,hr.payslip.input.user,model_hr_payslip_input,payrol
access_hr_payslip_worked_days_officer,hr.payslip.worked_days.officer,model_hr_payslip_worked_days,payroll.group_payroll_user,1,1,1,1
access_hr_payslip_run,hr.payslip.run,model_hr_payslip_run,payroll.group_payroll_manager,1,1,1,1
access_hr_rule_input_officer,hr.rule.input.office,model_hr_rule_input,payroll.group_payroll_user,1,1,1,1
access_hr_salary_rule_user,hr.salary.rule user,model_hr_salary_rule,payroll.group_payroll_user,1,0,0,0
access_hr_salary_rule_manager,hr.salary.rule manager,model_hr_salary_rule,payroll.group_payroll_manager,1,1,1,1
access_hr_salary_rule_user,hr.salary.rule.user,model_hr_salary_rule,payroll.group_payroll_user,1,0,0,0
access_hr_salary_rule_manager,hr.salary.rule.manager,model_hr_salary_rule,payroll.group_payroll_manager,1,1,1,1
access_hr_payslip_batch_employees_transient,hr.payslip.employees.batch,model_hr_payslip_employees,hr.group_hr_user,1,1,1,0
access_hr_payslip_lines_contribution_register_transient,payslip.lines.contribution.register,model_payslip_lines_contribution_register,hr.group_hr_user,1,1,1,0
access_hr_payslip_change_state,access_hr_payslip_change_state,model_hr_payslip_change_state,base.group_user,1,1,1,0
32 changes: 32 additions & 0 deletions payroll/views/hr_salary_rule_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,23 @@
options="{'mode': 'python'}"
id="condition_python"
nolabel="1"
groups="payroll.group_payroll_allow_python"
/>
<div
class="alert alert-info"
groups="!payroll.group_payroll_allow_python"
attrs="{'invisible':[('amount_select','!=','python')]}"
role="alert"
>
<p>
<h3><strong>Security Notice</strong></h3>
<hr />
<strong
>For security reasons, access to python code is restricted.</strong>
<i
> If you think there is an error, please ask your system administrator.</i>
</p>
</div>
<field
name="condition_range"
attrs="{'invisible':[('condition_select','!=','range')], 'required':[('condition_select','=','range')]}"
Expand Down Expand Up @@ -190,7 +206,23 @@
options="{'mode': 'python'}"
id="amount_python_compute"
nolabel="1"
groups="payroll.group_payroll_allow_python"
/>
<div
class="alert alert-info"
groups="!payroll.group_payroll_allow_python"
attrs="{'invisible':[('amount_select','!=','code')]}"
role="alert"
>
<p>
<h3><strong>Security Notice</strong></h3>
<hr />
<strong
>For security reasons, access to python code is restricted.</strong>
<i
> If you think there is an error, please ask your system administrator.</i>
</p>
</div>
<field
name="amount_percentage"
attrs="{'invisible':[('amount_select','!=','percentage')], 'required':[('amount_select','=','percentage')]}"
Expand Down