Skip to content

Commit

Permalink
Fix meeting.update
Browse files Browse the repository at this point in the history
  • Loading branch information
luisa-beerboom committed Oct 7, 2024
1 parent fc67a7a commit 25643f0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
7 changes: 3 additions & 4 deletions docs/actions/meeting.update.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@

// Group D
external_id: string;
enable_anonymous: boolean
custom_translations: JSON;

// Group E
Expand All @@ -186,9 +187,6 @@

// Group G
set_as_template: boolean;

// Group H
enable_anonymous: boolean
}
```

Expand All @@ -204,6 +202,8 @@ If `enable_anonymous` is set, this action will create an anonymous group for the

The meetings `anonymous_group_id` may not be used for the `assignment_poll_default_group_ids`, `topic_poll_default_group_ids` and `motion_poll_default_group_ids` fields.

`enable_anonymous` may only be set to true if `enable_anonymous` is set to true in the organization.

## Permissions
- Users with `meeting.can_manage_settings` can modify group A
- Users with `user.can_update` can modify group B
Expand All @@ -215,4 +215,3 @@ The meetings `anonymous_group_id` may not be used for the `assignment_poll_defau
if organization setting `require_duplicate_from` is false.
Users with a OML of `can_manage_organization` can modify group G if the organization setting
`require_duplicate_from` is true.
- Admins of the meeting can modify group H if the organization has `enable_anonymous` set to true.
2 changes: 1 addition & 1 deletion openslides_backend/action/actions/meeting/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def check_permissions(self, instance: dict[str, Any]) -> None:
):
raise MissingPermission(Permissions.Projector.CAN_MANAGE)

# group D and H check
# group D check
if any(
[
field in instance
Expand Down
42 changes: 42 additions & 0 deletions tests/system/action/meeting/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class MeetingUpdateActionTest(BaseActionTestCase):
def setUp(self) -> None:
super().setUp()
self.test_models: dict[str, dict[str, Any]] = {
ONE_ORGANIZATION_FQID: {"enable_anonymous": True},
"committee/1": {"name": "test_committee"},
"meeting/1": {
"name": "test_name",
Expand Down Expand Up @@ -622,6 +623,7 @@ def test_update_with_user(self) -> None:
"""Also tests if the anonymous group is created"""
self.set_models(
{
ONE_ORGANIZATION_FQID: {"enable_anonymous": True},
"committee/1": {"meeting_ids": [3]},
"meeting/3": {
"is_active_in_organization_id": 1,
Expand Down Expand Up @@ -673,6 +675,46 @@ def test_update_with_user(self) -> None:
},
)

def test_update_anonymous_if_disabled_in_orga(self) -> None:
self.set_models(
{
"committee/1": {"meeting_ids": [3]},
"meeting/3": {
"is_active_in_organization_id": 1,
"committee_id": 1,
"group_ids": [11],
"admin_group_id": 11,
},
"group/11": {"meeting_id": 3, "admin_group_for_meeting_id": 3},
}
)
response = self.request_json(
[
{
"action": "meeting.update",
"data": [
{
"name": "meeting",
"welcome_title": "title",
"welcome_text": "",
"description": "",
"location": "",
"start_time": 1623016800,
"end_time": 1623016800,
"enable_anonymous": True,
"organization_tag_ids": [],
"id": 3,
}
],
},
]
)
self.assert_status_code(response, 400)
self.assertIn(
"Anonymous users can not be enabled in this organization.",
response.json["message"],
)

def test_update_set_as_template_true(self) -> None:
self.set_models(self.test_models)
response = self.request(
Expand Down

0 comments on commit 25643f0

Please sign in to comment.