summaryrefslogtreecommitdiff
path: root/addons/gamification/security
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/gamification/security
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/gamification/security')
-rw-r--r--addons/gamification/security/gamification_security.xml36
-rw-r--r--addons/gamification/security/ir.model.access.csv35
2 files changed, 71 insertions, 0 deletions
diff --git a/addons/gamification/security/gamification_security.xml b/addons/gamification/security/gamification_security.xml
new file mode 100644
index 00000000..574c89cc
--- /dev/null
+++ b/addons/gamification/security/gamification_security.xml
@@ -0,0 +1,36 @@
+<odoo noupdate="1">
+
+ <record id="goal_user_visibility" model="ir.rule">
+ <field name="name">User can only see his/her goals or goal from the same challenge in board visibility</field>
+ <field name="model_id" ref="model_gamification_goal"/>
+ <field name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal'))]"/>
+ <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),
+ '&amp;',
+ ('challenge_id.user_ids','in',user.id),
+ ('challenge_id.visibility_mode','=','ranking')]</field>
+ </record>
+
+ <record id="goal_gamification_manager_visibility" model="ir.rule">
+ <field name="name">Manager can see any goal</field>
+ <field name="model_id" ref="model_gamification_goal"/>
+ <field name="groups" eval="[(4, ref('base.group_erp_manager'))]"/>
+ <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">[(1, '=', 1)]</field>
+ </record>
+
+ <record id="goal_global_multicompany" model="ir.rule">
+ <field name="name">Multicompany rule on challenges</field>
+ <field name="model_id" ref="model_gamification_goal"/>
+ <field name="domain_force">[('user_id.company_id', 'in', company_ids)]</field>
+ </record>
+
+</odoo>
diff --git a/addons/gamification/security/ir.model.access.csv b/addons/gamification/security/ir.model.access.csv
new file mode 100644
index 00000000..ed8f9ffc
--- /dev/null
+++ b/addons/gamification/security/ir.model.access.csv
@@ -0,0 +1,35 @@
+id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
+
+goal_employee,"Goal Employee",model_gamification_goal,base.group_user,1,1,0,0
+goal_manager,"Goal Manager",model_gamification_goal,base.group_erp_manager,1,1,1,1
+goal_portal,"Goal Portal",gamification.model_gamification_goal,base.group_portal,1,1,0,0
+
+goal_definition_employee,"Goal Definition Employee",model_gamification_goal_definition,base.group_user,1,0,0,0
+goal_definition_manager,"Goal Definition Manager",model_gamification_goal_definition,base.group_erp_manager,1,1,1,1
+goal_definition_portal,"Goal Definition Portal",gamification.model_gamification_goal_definition,base.group_portal,1,0,0,0
+
+challenge_employee,"Goal Challenge Employee",model_gamification_challenge,base.group_user,1,0,0,0
+challenge_manager,"Goal Challenge Manager",model_gamification_challenge,base.group_erp_manager,1,1,1,1
+challenge_portal,"Goal Challenge Portal",gamification.model_gamification_challenge,base.group_portal,1,0,0,0
+
+challenge_line_employee,"Challenge Line Employee",model_gamification_challenge_line,base.group_user,1,0,0,0
+challenge_line_manager,"Challenge Line Manager",model_gamification_challenge_line,base.group_erp_manager,1,1,1,1
+challenge_line_portal,"Challenge Line Portal",gamification.model_gamification_challenge_line,base.group_portal,1,0,0,0
+
+badge_employee,"Badge Employee",model_gamification_badge,base.group_user,1,0,0,0
+badge_manager,"Badge Manager",model_gamification_badge,base.group_erp_manager,1,1,1,1
+badge_portal,"Badge Portal",gamification.model_gamification_badge,base.group_portal,1,0,0,0
+badge_public,"Badge Public",gamification.model_gamification_badge,base.group_public,1,0,0,0
+
+badge_user_employee,"Badge-user Employee",model_gamification_badge_user,base.group_user,1,1,1,0
+badge_user_manager,"Badge-user Manager",model_gamification_badge_user,base.group_erp_manager,1,1,1,1
+badge_user_portal,"Badge-user Portal",gamification.model_gamification_badge_user,base.group_portal,1,1,1,0
+badge_user_public,"Badge-user Public",gamification.model_gamification_badge_user,base.group_public,1,0,0,0
+
+gamification_karma_rank_access_all,gamification.karma.rank.access.all,gamification.model_gamification_karma_rank,,1,0,0,0
+gamification_karma_rank_access_user_manager,gamification.karma.rank.access.user.manager,gamification.model_gamification_karma_rank,base.group_system,1,1,1,1
+gamification_karma_tracking_access_all,gamification.karma.tracking.access.all,gamification.model_gamification_karma_tracking,,0,0,0,0
+gamification_karma_tracking_access_user_manager,gamification.karma.tracking.access.user.manager,gamification.model_gamification_karma_tracking,base.group_system,1,1,1,1
+
+access_gamification_goal_wizard,access.gamification.goal.wizard,model_gamification_goal_wizard,base.group_user,1,1,1,0
+access_gamification_badge_user_wizard,access.gamification.badge.user.wizard,model_gamification_badge_user_wizard,base.group_user,1,1,1,0