[ADD] gamification: security rules

bzr revid: mat@openerp.com-20130313095154-b5wi1ohu0wo6hz5w
This commit is contained in:
Martin Trigaux 2013-03-13 10:51:54 +01:00
parent 888dcb5850
commit 95c244d35a
5 changed files with 55 additions and 5 deletions

View File

@ -23,7 +23,7 @@
'version': '1.0',
'author': 'OpenERP SA',
'category': 'Human Resources',
'depends': ['mail', 'report_webkit','hr'],
'depends': ['mail', 'hr'],
'description': """Gamification of goals""",
'data': [
@ -31,7 +31,9 @@
'badge_view.xml',
'goal_view.xml',
'cron.xml',
],
'security/gamification_security.xml',
'security/ir.model.access.csv',
],
'installable': True,
'application': True,
'css': ['static/src/css/goal.css'],

View File

@ -151,7 +151,7 @@ class gamification_goal(osv.Model):
required=True,
track_visibility='always'),
'computation_mode': fields.related('type_id','computation_mode',
'computation_mode': fields.related('type_id', 'computation_mode',
type='char',
string="Type computation mode"),
'remind_update_delay': fields.integer('Remind delay',

View File

@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record model="ir.module.category" id="module_goal_category">
<field name="name">Goal</field>
<field name="description">Helps you handle your lunch needs, if you are a manager you will be able to create new products, cashmoves and to confirm or cancel orders.</field>
<field name="sequence">17</field>
</record>
<record id="group_goal_user" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="module_goal_category"/>
</record>
<record id="group_goal_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('group_goal_user'))]"/>
<field name="category_id" ref="module_goal_category"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>
<data noupdate="1">
<record id="goal_user_visibility" model="ir.rule">
<field name="name">User can only see his/her goals</field>
<field name="model_id" ref="model_gamification_goal"/>
<field name="groups" eval="[(4, ref('group_goal_user'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="domain_force">[('user_id','=',user.id)]</field>
</record>
<record id="goal_manager_visibility" model="ir.rule">
<field name="name">Manager has all rights on user's goals</field>
<field name="model_id" ref="model_gamification_goal"/>
<field name="groups" eval="[(4, ref('group_goal_manager'))]"/>
</record>
<record id="goal_plan_manager_visibility" model="ir.rule">
<field name="name">Manager has all rights on goal plans</field>
<field name="model_id" ref="model_gamification_goal_plan"/>
<field name="groups" eval="[(4, ref('group_goal_manager'))]"/>
</record>
</data>
</openerp>

View File

@ -0,0 +1,5 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
goal_manager,"Goal Manager",model_gamification_goal,group_goal_manager,1,1,1,1
goal_user,"Goal User",model_gamification_goal,group_goal_user,1,1,0,0
plan_manager,"Goal Plan Manager",model_gamification_goal_plan,group_goal_manager,1,1,1,1
plan_user,"Goal Plan User",model_gamification_goal_plan,group_goal_user,1,0,0,0
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 goal_manager Goal Manager model_gamification_goal group_goal_manager 1 1 1 1
3 goal_user Goal User model_gamification_goal group_goal_user 1 1 0 0
4 plan_manager Goal Plan Manager model_gamification_goal_plan group_goal_manager 1 1 1 1
5 plan_user Goal Plan User model_gamification_goal_plan group_goal_user 1 0 0 0

View File

@ -147,7 +147,7 @@
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(act_hr_employee_2_hr__evaluation_interview)d" string="Appraisal Interviews" type="action"/>
</xpath>
<xpath expr="//page[@string='Public Information']" position="before">
<xpath expr="//page[@string='Public Information']" position="after">
<page string="Goals">
<field name="goal_ids" widget="many2many_kanban" />
</page>
@ -415,7 +415,7 @@
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
<menuitem id="gamification_plan_menu_hr" parent="menu_eval_hr" action="gamification.goal_plan_list_action" />
<menuitem id="gamification_plan_menu_hr" parent="menu_eval_hr" action="gamification.goal_plan_list_action" groups="gamification.group_goal_manager" />
<!-- Email Compose message Action-->
<act_window