From 1ecba213f4f188ba7a235e0cf4fc029535f0bdba Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 16 Nov 2015 18:43:04 +0100 Subject: [PATCH] [IMP] Newly created users get all manager access right Coming from a bug in web_settings_dashboard. Invited user didn't have any rights when created from the dashboard, which was leading to an error. This bug leaded to a new discussion. Better to have basic employee having user rights for all main applications. For bigger entreprises there is an admin that will carefully remove extra rights, if necessary. The target is small businesses, it makes sense that every way to create a user gives the same result. In conclusion, each new user has a full access to the applications by default How is it implemented ? We added an inactive default user which original access right to the groups 'base.group_user' and 'base.group_partner_manager' in base. Each application will extend the default user's access right by adding the maximal access right for this application. On user creation, we will use by default the 'group_id' field from the default user. We will in the same time remove the ugly 'default_groups_ref' key which was passed sometimes in the context for some fields in some views, and sometimes nothing. So, the user can modify the access rights for the default user, but he should be aware that removing project user access rights for a default user will prevent a *created on the fly in a task* user will not be able to access the task. --- addons/account/security/account_security.xml | 4 ++++ addons/event/security/event_security.xml | 4 ++++ addons/fleet/security/fleet_security.xml | 3 +++ addons/hr/security/hr_security.xml | 4 ++++ .../security/im_livechat_channel_security.xml | 4 ++++ addons/lunch/security/lunch_security.xml | 4 ++++ .../security/marketing_campaign_security.xml | 5 +++++ .../security/mass_mailing_security.xml | 4 ++++ addons/mrp/security/mrp_security.xml | 4 ++++ .../security/point_of_sale_security.xml | 4 ++++ addons/project/security/project_security.xml | 4 ++++ addons/purchase/security/purchase_security.xml | 4 ++++ addons/stock/security/stock_security.xml | 4 ++++ addons/survey/security/survey_security.xml | 4 ++++ addons/website/data/data.xml | 4 ++++ openerp/addons/base/base_data.xml | 7 +++++++ openerp/addons/base/res/res_users.py | 14 ++++---------- openerp/addons/base/security/base_security.xml | 16 ++++++++++++++++ 18 files changed, 87 insertions(+), 10 deletions(-) diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index 5547e561cac..1bd9765d455 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -21,6 +21,10 @@ + + + + Pro-forma Invoices diff --git a/addons/event/security/event_security.xml b/addons/event/security/event_security.xml index 44a9a1b9c8a..ebdbac4a967 100644 --- a/addons/event/security/event_security.xml +++ b/addons/event/security/event_security.xml @@ -15,6 +15,10 @@ + + + + Schedule Emails on Event Subscription diff --git a/addons/fleet/security/fleet_security.xml b/addons/fleet/security/fleet_security.xml index 0d11edf023a..190a85729a4 100644 --- a/addons/fleet/security/fleet_security.xml +++ b/addons/fleet/security/fleet_security.xml @@ -15,6 +15,9 @@ + + + diff --git a/addons/hr/security/hr_security.xml b/addons/hr/security/hr_security.xml index a16f8074cf8..3a598bb4a70 100644 --- a/addons/hr/security/hr_security.xml +++ b/addons/hr/security/hr_security.xml @@ -20,6 +20,10 @@ + + + + Attendances diff --git a/addons/im_livechat/security/im_livechat_channel_security.xml b/addons/im_livechat/security/im_livechat_channel_security.xml index 56f67c7c4bb..5b0266fc28a 100644 --- a/addons/im_livechat/security/im_livechat_channel_security.xml +++ b/addons/im_livechat/security/im_livechat_channel_security.xml @@ -21,5 +21,9 @@ + + + + diff --git a/addons/lunch/security/lunch_security.xml b/addons/lunch/security/lunch_security.xml index a4757302500..c622fed989c 100644 --- a/addons/lunch/security/lunch_security.xml +++ b/addons/lunch/security/lunch_security.xml @@ -16,6 +16,10 @@ + + + + lunch.cashmove: do not see other people's cashmove diff --git a/addons/marketing_campaign/security/marketing_campaign_security.xml b/addons/marketing_campaign/security/marketing_campaign_security.xml index 259a2f3a889..ab0b3e303f9 100644 --- a/addons/marketing_campaign/security/marketing_campaign_security.xml +++ b/addons/marketing_campaign/security/marketing_campaign_security.xml @@ -12,5 +12,10 @@ + + + + + diff --git a/addons/mass_mailing/security/mass_mailing_security.xml b/addons/mass_mailing/security/mass_mailing_security.xml index 425d1d2bf43..d26cf84b66f 100644 --- a/addons/mass_mailing/security/mass_mailing_security.xml +++ b/addons/mass_mailing/security/mass_mailing_security.xml @@ -7,6 +7,10 @@ + + + + Use subscription pop up on the website diff --git a/addons/mrp/security/mrp_security.xml b/addons/mrp/security/mrp_security.xml index cb8a4667082..dff58a97570 100644 --- a/addons/mrp/security/mrp_security.xml +++ b/addons/mrp/security/mrp_security.xml @@ -14,6 +14,10 @@ + + + + Manage Work Order Operations diff --git a/addons/point_of_sale/security/point_of_sale_security.xml b/addons/point_of_sale/security/point_of_sale_security.xml index 1d3e6123eef..1c4cf30e363 100644 --- a/addons/point_of_sale/security/point_of_sale_security.xml +++ b/addons/point_of_sale/security/point_of_sale_security.xml @@ -13,6 +13,10 @@ + + + + Point Of Sale Bank Statement POS User diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index 03a2ed38adb..2d8dc77ee81 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -15,6 +15,10 @@ + + + + Task's Work on Tasks diff --git a/addons/purchase/security/purchase_security.xml b/addons/purchase/security/purchase_security.xml index cc732a8cabd..edccd9afd73 100644 --- a/addons/purchase/security/purchase_security.xml +++ b/addons/purchase/security/purchase_security.xml @@ -15,6 +15,10 @@ + + + + Analytic Accounting for Purchases diff --git a/addons/stock/security/stock_security.xml b/addons/stock/security/stock_security.xml index 39d26efc58f..cfc388c637c 100644 --- a/addons/stock/security/stock_security.xml +++ b/addons/stock/security/stock_security.xml @@ -18,6 +18,10 @@ + + + + Manage Lots / Serial Numbers diff --git a/addons/survey/security/survey_security.xml b/addons/survey/security/survey_security.xml index afaf592686b..470a5685ac9 100644 --- a/addons/survey/security/survey_security.xml +++ b/addons/survey/security/survey_security.xml @@ -15,6 +15,10 @@ + + + + Access to survey for regular users diff --git a/addons/website/data/data.xml b/addons/website/data/data.xml index f30068b72e9..98db6fe9cba 100644 --- a/addons/website/data/data.xml +++ b/addons/website/data/data.xml @@ -43,6 +43,10 @@ + + + + Website Apps ir.module.module diff --git a/openerp/addons/base/base_data.xml b/openerp/addons/base/base_data.xml index 51904e27201..ee031437a2f 100644 --- a/openerp/addons/base/base_data.xml +++ b/openerp/addons/base/base_data.xml @@ -51,6 +51,13 @@ Administrator]]> + + + default user + default + + + diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index db1c6c09a48..c929b2dab59 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -262,16 +262,10 @@ class res_users(osv.osv): return False def _get_group(self,cr, uid, context=None): - dataobj = self.pool.get('ir.model.data') - result = [] - try: - dummy,group_id = dataobj.get_object_reference(cr, SUPERUSER_ID, 'base', 'group_user') - result.append(group_id) - dummy,group_id = dataobj.get_object_reference(cr, SUPERUSER_ID, 'base', 'group_partner_manager') - result.append(group_id) - except ValueError: - # If these groups does not exists anymore - pass + default_user = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'base.default_user') + if not default_user: + return [] + result = default_user.groups_id.ids return result _defaults = { diff --git a/openerp/addons/base/security/base_security.xml b/openerp/addons/base/security/base_security.xml index c5c60632758..073acaebd91 100644 --- a/openerp/addons/base/security/base_security.xml +++ b/openerp/addons/base/security/base_security.xml @@ -21,10 +21,18 @@ + + + + Employee + + + + Enable Light Multi Company @@ -55,10 +63,18 @@ + + + + Contact Creation + + + +