-
Notifications
You must be signed in to change notification settings - Fork 51
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
[IMP] base: rename field groups_id into group_ids & all_group_ids #169
Conversation
a9dcb73
to
7a96f02
Compare
7a96f02
to
bef8239
Compare
a8798f9
to
6e05e87
Compare
69ac0dc
to
6e05e87
Compare
6e05e87
to
f239894
Compare
a9238eb
to
e12abaa
Compare
436b1ae
to
84da0c6
Compare
84da0c6
to
5c53bec
Compare
5c53bec
to
ecbe99e
Compare
2b46f91
to
6598374
Compare
6598374
to
ef6b9a8
Compare
@aj-fuentes the branch is ready. We are simply waiting for runbot to build it one last time before merging. |
Missing link to upgrade PR in the commit message -> hence matt is red here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robodoo delegate=rco-odoo
Still consider linking the right upgrade PR via the commit message ;)
ef6b9a8
to
9ec68fb
Compare
@aj-fuentes done 👍 |
@robodoo r+ |
@Gorash @rco-odoo linked pull request(s) odoo/enterprise#74122, odoo/odoo#179354 not ready. Linked PRs are not staged until all of them are ready. |
The private method _has_group() is the implementation of method has_group(), and they only differ for 'base.group_no_one', where the public method takes into account the session. For all the other groups, one should use the public method. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The "group definitions" was using a dummy element to indicate whether the user is in debug mode. This allowed the implications of the groups in the data to not be changed. The 'debug-mode' element is not used as data (neither in views nor in xmlids). The management of 'base.group_no_one' is not consistent from the start. It is a magic group that historically was added or removed depending on the url used. 'base.group_no_one' is not to be considered as a group but as a display feature independent of security and user set. Typically the templates do not match the intent. In each case, we want an "and" and not an "or": e.g.: `<filter name="not_secured" string="Not Secured" ... groups="account.group_account_secured,base.group_no_one"/>` or `<menuitem ... name="Configuration" ... groups="base.group_system,base.group_no_one"/>` We isolate this special behavior inside the processing of views. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The interface feature is in their own file. This will ease the review of the commits that follow. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…user_ids (all_user_ids is temporarily equal to user_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…up_ids (all_group_ids is temporary equal to group_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
From this point on, the fields 'all_group_ids' and 'all_user_ids' use the reflexive transitive closure of implied groups. Models: ``` <res.groups>: implied_ids = Many2many <res.groups> Users of this group are also implicitly part of these groups (db table 'res_groups_implied_rel') all_implied_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_ids' implied_by_ids = Many2many <res.groups> Inverse relation of 'implied_ids' all_implied_by_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_by_ids' user_ids = Many2many <res.users> Users with this group (db table: 'res_groups_users_rel') all_user_ids = Many2many <res.users> Users and implied users <res.users>: group_ids = Many2many <res.groups> Group added directly to this user (db table: 'res_groups_users_rel') all_group_ids = Many2many <res.groups> Groups and implied groups ``` Concept: ``` The groups involved are to be interpreted as sets. Thus we can define groups that we will call for example N, Z... such as mathematical sets. ┌──────────────────────────────────────────┐ │ C ┌──────────────────────────┐ │ │ │ R ┌───────────────────┐ │ ┌──────┐ | "C" │ │ │ Q ┌────────────┐ │ │ │ I | | "I" implied "C" │ │ │ │ Z ┌─────┐ │ │ │ │ | | "R" implied "C" │ │ │ │ │ N │ │ │ │ │ │ │ "Q" implied "R" │ │ │ │ └─────┘ │ │ │ │ │ │ "R\Q" implied "R" │ │ │ └────────────┘ │ │ │ │ │ "Z" implied "Q" │ │ └───────────────────┘ │ │ │ │ "N" implied "Z" │ │ ┌───────────────┐ │ │ │ │ │ │ │ R\Q │ │ │ │ │ │ │ └───────────────┘ │ └──────┘ │ │ └──────────────────────────┘ │ └──────────────────────────────────────────┘ For example: * A manager group will imply a user group: all managers are users (like Z imply C); * A group "computer developer employee" will imply that he is an employee group, a user group, that he has access to the timesheet user group.... "computer developer employee" is therefore a set of users in the intersection of these groups. These users will therefore have all the rights of these groups in addition to their own access rights. ``` XML data example: ```xml <record model="res.groups" id="group_system"> <field name="name">Settings</field> <field name="implied_ids" eval="[Command.link(ref('group_erp_manager')), Command.link(ref('group_sanitize_override'))]"/> <field name="user_ids" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/> </record> ``` ```xml <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> <field name="implied_by_ids" eval="[Command.link(ref('group_user')), Command.link(ref('group_system'))]"/> </record> or <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> </record> <record id="group_user"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> <record id="group_system"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> ``` PY example: ```py group_helpdesk = self.env.ref('helpdesk.group_helpdesk_user') group_export = self.env.ref('base.group_allow_export') group_portal = self.env.ref('base.group_portal') user_portal_helpdesck = self.env['res.users'].search([('all_group_ids', 'in', group_helpdesk.id), ('all_group_ids', 'in', group_portal.id)]) user_portal_helpdesck.group_ids += group_export user_export = group_export.all_user_ids user_has_export = group_export.user_ids ``` Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
Added a new 'technical' UI to easily visualize the implications of the groups and to be able to easily access the access right. This change completely removes the hack of reified fields, and implements the UI with a client-side widget. closes #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
Task: 4166361 & 4341594 related: odoo/odoo#179354 odoo/upgrade#6841 odoo/enterprise#74122 closes #169 Related: odoo/odoo#179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Signed-off-by: Raphael Collet <rco@odoo.com>
The private method _has_group() is the implementation of method has_group(), and they only differ for 'base.group_no_one', where the public method takes into account the session. For all the other groups, one should use the public method. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The "group definitions" was using a dummy element to indicate whether the user is in debug mode. This allowed the implications of the groups in the data to not be changed. The 'debug-mode' element is not used as data (neither in views nor in xmlids). The management of 'base.group_no_one' is not consistent from the start. It is a magic group that historically was added or removed depending on the url used. 'base.group_no_one' is not to be considered as a group but as a display feature independent of security and user set. Typically the templates do not match the intent. In each case, we want an "and" and not an "or": e.g.: `<filter name="not_secured" string="Not Secured" ... groups="account.group_account_secured,base.group_no_one"/>` or `<menuitem ... name="Configuration" ... groups="base.group_system,base.group_no_one"/>` We isolate this special behavior inside the processing of views. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The interface feature is in their own file. This will ease the review of the commits that follow. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…user_ids (all_user_ids is temporarily equal to user_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…up_ids (all_group_ids is temporary equal to group_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
From this point on, the fields 'all_group_ids' and 'all_user_ids' use the reflexive transitive closure of implied groups. Models: ``` <res.groups>: implied_ids = Many2many <res.groups> Users of this group are also implicitly part of these groups (db table 'res_groups_implied_rel') all_implied_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_ids' implied_by_ids = Many2many <res.groups> Inverse relation of 'implied_ids' all_implied_by_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_by_ids' user_ids = Many2many <res.users> Users with this group (db table: 'res_groups_users_rel') all_user_ids = Many2many <res.users> Users and implied users <res.users>: group_ids = Many2many <res.groups> Group added directly to this user (db table: 'res_groups_users_rel') all_group_ids = Many2many <res.groups> Groups and implied groups ``` Concept: ``` The groups involved are to be interpreted as sets. Thus we can define groups that we will call for example N, Z... such as mathematical sets. ┌──────────────────────────────────────────┐ │ C ┌──────────────────────────┐ │ │ │ R ┌───────────────────┐ │ ┌──────┐ | "C" │ │ │ Q ┌────────────┐ │ │ │ I | | "I" implied "C" │ │ │ │ Z ┌─────┐ │ │ │ │ | | "R" implied "C" │ │ │ │ │ N │ │ │ │ │ │ │ "Q" implied "R" │ │ │ │ └─────┘ │ │ │ │ │ │ "R\Q" implied "R" │ │ │ └────────────┘ │ │ │ │ │ "Z" implied "Q" │ │ └───────────────────┘ │ │ │ │ "N" implied "Z" │ │ ┌───────────────┐ │ │ │ │ │ │ │ R\Q │ │ │ │ │ │ │ └───────────────┘ │ └──────┘ │ │ └──────────────────────────┘ │ └──────────────────────────────────────────┘ For example: * A manager group will imply a user group: all managers are users (like Z imply C); * A group "computer developer employee" will imply that he is an employee group, a user group, that he has access to the timesheet user group.... "computer developer employee" is therefore a set of users in the intersection of these groups. These users will therefore have all the rights of these groups in addition to their own access rights. ``` XML data example: ```xml <record model="res.groups" id="group_system"> <field name="name">Settings</field> <field name="implied_ids" eval="[Command.link(ref('group_erp_manager')), Command.link(ref('group_sanitize_override'))]"/> <field name="user_ids" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/> </record> ``` ```xml <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> <field name="implied_by_ids" eval="[Command.link(ref('group_user')), Command.link(ref('group_system'))]"/> </record> or <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> </record> <record id="group_user"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> <record id="group_system"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> ``` PY example: ```py group_helpdesk = self.env.ref('helpdesk.group_helpdesk_user') group_export = self.env.ref('base.group_allow_export') group_portal = self.env.ref('base.group_portal') user_portal_helpdesck = self.env['res.users'].search([('all_group_ids', 'in', group_helpdesk.id), ('all_group_ids', 'in', group_portal.id)]) user_portal_helpdesck.group_ids += group_export user_export = group_export.all_user_ids user_has_export = group_export.user_ids ``` Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
Added a new 'technical' UI to easily visualize the implications of the groups and to be able to easily access the access right. This change completely removes the hack of reified fields, and implements the UI with a client-side widget. closes #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
Task: 4166361 & 4341594 related: odoo/odoo#179354 odoo/upgrade#6841 odoo/enterprise#74122 closes #169 Related: odoo/odoo#179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Signed-off-by: Raphael Collet <rco@odoo.com>
Task: 4166361 & 4341594 related: odoo/odoo#179354 odoo/upgrade#6841 odoo/enterprise#74122
9ec68fb
to
5644415
Compare
@robodoo r+ |
The private method _has_group() is the implementation of method has_group(), and they only differ for 'base.group_no_one', where the public method takes into account the session. For all the other groups, one should use the public method. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The "group definitions" was using a dummy element to indicate whether the user is in debug mode. This allowed the implications of the groups in the data to not be changed. The 'debug-mode' element is not used as data (neither in views nor in xmlids). The management of 'base.group_no_one' is not consistent from the start. It is a magic group that historically was added or removed depending on the url used. 'base.group_no_one' is not to be considered as a group but as a display feature independent of security and user set. Typically the templates do not match the intent. In each case, we want an "and" and not an "or": e.g.: `<filter name="not_secured" string="Not Secured" ... groups="account.group_account_secured,base.group_no_one"/>` or `<menuitem ... name="Configuration" ... groups="base.group_system,base.group_no_one"/>` We isolate this special behavior inside the processing of views. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
The interface feature is in their own file. This will ease the review of the commits that follow. Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…user_ids (all_user_ids is temporarily equal to user_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
…up_ids (all_group_ids is temporary equal to group_ids) Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
From this point on, the fields 'all_group_ids' and 'all_user_ids' use the reflexive transitive closure of implied groups. Models: ``` <res.groups>: implied_ids = Many2many <res.groups> Users of this group are also implicitly part of these groups (db table 'res_groups_implied_rel') all_implied_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_ids' implied_by_ids = Many2many <res.groups> Inverse relation of 'implied_ids' all_implied_by_ids = Many2many <res.groups> Reflexive transitive closure of 'implied_by_ids' user_ids = Many2many <res.users> Users with this group (db table: 'res_groups_users_rel') all_user_ids = Many2many <res.users> Users and implied users <res.users>: group_ids = Many2many <res.groups> Group added directly to this user (db table: 'res_groups_users_rel') all_group_ids = Many2many <res.groups> Groups and implied groups ``` Concept: ``` The groups involved are to be interpreted as sets. Thus we can define groups that we will call for example N, Z... such as mathematical sets. ┌──────────────────────────────────────────┐ │ C ┌──────────────────────────┐ │ │ │ R ┌───────────────────┐ │ ┌──────┐ | "C" │ │ │ Q ┌────────────┐ │ │ │ I | | "I" implied "C" │ │ │ │ Z ┌─────┐ │ │ │ │ | | "R" implied "C" │ │ │ │ │ N │ │ │ │ │ │ │ "Q" implied "R" │ │ │ │ └─────┘ │ │ │ │ │ │ "R\Q" implied "R" │ │ │ └────────────┘ │ │ │ │ │ "Z" implied "Q" │ │ └───────────────────┘ │ │ │ │ "N" implied "Z" │ │ ┌───────────────┐ │ │ │ │ │ │ │ R\Q │ │ │ │ │ │ │ └───────────────┘ │ └──────┘ │ │ └──────────────────────────┘ │ └──────────────────────────────────────────┘ For example: * A manager group will imply a user group: all managers are users (like Z imply C); * A group "computer developer employee" will imply that he is an employee group, a user group, that he has access to the timesheet user group.... "computer developer employee" is therefore a set of users in the intersection of these groups. These users will therefore have all the rights of these groups in addition to their own access rights. ``` XML data example: ```xml <record model="res.groups" id="group_system"> <field name="name">Settings</field> <field name="implied_ids" eval="[Command.link(ref('group_erp_manager')), Command.link(ref('group_sanitize_override'))]"/> <field name="user_ids" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/> </record> ``` ```xml <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> <field name="implied_by_ids" eval="[Command.link(ref('group_user')), Command.link(ref('group_system'))]"/> </record> or <record model="res.groups" id="group_no_one"> <field name="name">Technical Features</field> </record> <record id="group_user"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> <record id="group_system"> <field name="implied_ids" eval="[Command.link(ref('group_no_one'))]"/> </record> ``` PY example: ```py group_helpdesk = self.env.ref('helpdesk.group_helpdesk_user') group_export = self.env.ref('base.group_allow_export') group_portal = self.env.ref('base.group_portal') user_portal_helpdesck = self.env['res.users'].search([('all_group_ids', 'in', group_helpdesk.id), ('all_group_ids', 'in', group_portal.id)]) user_portal_helpdesck.group_ids += group_export user_export = group_export.all_user_ids user_has_export = group_export.user_ids ``` Part-of: #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
Added a new 'technical' UI to easily visualize the implications of the groups and to be able to easily access the access right. This change completely removes the hack of reified fields, and implements the UI with a client-side widget. closes #179354 Related: odoo/enterprise#74122 Related: odoo/upgrade#6841 Related: odoo/upgrade-util#169 Signed-off-by: Raphael Collet <rco@odoo.com>
No description provided.