Skip to content
Open
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
4 changes: 2 additions & 2 deletions project_group/security/project_project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="name">Project: employees: Groups</field>
<field name="model_id" ref="project.model_project_project" />
<field name="domain_force">[
('privacy_visibility', '=', 'followers'),
('privacy_visibility', 'in', ('followers', 'invited_users')),
('group_ids', 'in', user.all_group_ids.ids)
]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]" />
Expand All @@ -17,7 +17,7 @@
<field name="model_id" ref="project.model_project_task" />
<field name="domain_force">[
('project_id', '!=', False),
('project_id.privacy_visibility', '=', 'followers'),
('project_id.privacy_visibility', 'in', ('followers', 'invited_users')),
('project_id.group_ids', 'in', user.all_group_ids.ids)
]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]" />
Expand Down
34 changes: 34 additions & 0 deletions project_group/tests/test_project_visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,37 @@ def test_02_access_rights(self):
"employees",
"privacy_visibility should be 'employees' after update",
)

def test_03_invited_users_group_access(self):
"""Group members get access on 'invited_users' projects."""
invited_project = self.ProjectObj.create(
{
"name": "Invited Users Project",
"privacy_visibility": "invited_users",
"group_ids": [Command.set([self.group1.id])],
}
)
self.project_group_user.write({"group_ids": [Command.link(self.group2.id)]})
self.assertNotIn(
invited_project,
self.ProjectObj.with_user(self.project_group_user).search(
[("id", "=", invited_project.id)]
),
"User outside the project groups should not see the project",
)

self.project_group_user.write(
{
"group_ids": [
Command.unlink(self.group2.id),
Command.link(self.group1.id),
]
}
)
self.assertIn(
invited_project,
self.ProjectObj.with_user(self.project_group_user).search(
[("id", "=", invited_project.id)]
),
"User in a project group should see the 'invited_users' project",
)
2 changes: 1 addition & 1 deletion project_group/views/project_project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<xpath expr="//field[@name='privacy_visibility']/.." position="inside">
<field
name="group_ids"
invisible="privacy_visibility != 'followers'"
invisible="privacy_visibility not in ('followers', 'invited_users')"
widget="many2many_tags"
/>
</xpath>
Expand Down
Loading