Skip to content

Conversation

@luisa-beerboom
Copy link
Member

@luisa-beerboom luisa-beerboom commented Nov 12, 2025

Closes #2111
See OpenSlides/openslides-meta#347

  • user.update now deletes the meeting user when the group_ids are emptied. (Uses custom meeting_user.delete class bc using the actual one would cause circular dep exceptions)
  • motion.create doesn't automatically assign the calling user anymore. The chosen submitters now need to be given as meeting_user ids via the new field submitter_meeting_user_ids instead of how it was done before (as user ids via the field submitter_ids)
  • chat_message.create now only works if the user is in the meeting
  • same with personal notes

TODO:

  • Write migration
  • Take care of supporter after PR Implement motion_supporter model #3173 is merged
  • remaining tests in migration (see todos in code)
  • Write client issue for this (motion create should auto-fill submitter if possible)

@luisa-beerboom luisa-beerboom removed their assignment Dec 1, 2025
Copy link
Member

@hjanott hjanott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change it will be impossible to remove a user from a meeting and rejoin him with all relations to meeting user submodels set in place again because the information is lost.
In general I'm against this change unless the user_id is stored in all meeting_user related models as well. However that's also not well designed.

from ...action import Action
from ..speaker.delete import SpeakerDeleteAction
from .set_present import UserSetPresentAction
from ..user.set_present import UserSetPresentAction
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Comment on lines +133 to +136
And(
FilterOperator("user_id", "=", instance["id"]),
FilterOperator("meeting_id", "=", removed_meeting_id),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
And(
FilterOperator("user_id", "=", instance["id"]),
FilterOperator("meeting_id", "=", removed_meeting_id),
),
self.get_meeting_user_filter(instance["id"]), removed_meeting_id)),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or use get_meeting_user.

Comment on lines +150 to +162
musers = self.reader.get_all(
"meeting_user",
list(COLLECTION_TO_MIGRATION_FIELDS["meeting_user"]) + ["group_ids"],
)
musers_to_delete = {
id_: {
field: val
for field, val in model.items()
if val and field in list(COLLECTION_TO_MIGRATION_FIELDS["meeting_user"])
}
for id_, model in musers.items()
if not model.get("group_ids")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more efficient to filter all meeting users where group_ids is empty list or None.

self, musers_to_delete: dict[int, dict[str, Any]]
) -> tuple[list[int], list[BaseRequestEvent]]:
"""
Returns the list of speaker_ids that should be deleted ad pos 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns the list of speaker_ids that should be deleted ad pos 0
Returns the list of speaker_ids that should be deleted at pos 0

Comment on lines +351 to +352
self.countdown_change_events: list[BaseRequestEvent] = []
return delete_speaker_ids, self.countdown_change_events
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.countdown_change_events will always be an empty list and never be accessed by its name here. Better to create it after this function was used.

) -> tuple[list[int], list[BaseRequestEvent]]:
"""
Returns the list of speaker_ids that should be deleted ad pos 0
and the list of events for the countdown changes for that deletion at pos 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below comment.

Suggested change
and the list of events for the countdown changes for that deletion at pos 1

Comment on lines +229 to +230
for id_, meeting_user in models_to_delete.items():
for field, value in meeting_user.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for id_, meeting_user in models_to_delete.items():
for field, value in meeting_user.items():
for id_, model in models_to_delete.items():
for field, value in model.items():

Comment on lines +231 to +236
if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field):
if is_list_field(field) and value:
for val_id in value:
self.handle_id(collection, id_, val_id, field, field_data)
elif value:
self.handle_id(collection, id_, value, field, field_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field):
if is_list_field(field) and value:
for val_id in value:
self.handle_id(collection, id_, val_id, field, field_data)
elif value:
self.handle_id(collection, id_, value, field, field_data)
if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field) and value:
if is_list_field(field):
for val_id in value:
self.handle_id(collection, id_, val_id, field, field_data)
else:
self.handle_id(collection, id_, value, field, field_data)

@Elblinator
Copy link
Member

Elblinator commented Dec 23, 2025

If a participant is allowed to create motions/amendments but cannot manage motions/ meta data the backend is stopping the participant from creating the motion/amenment:

Motion:

{
  "action": "motion.create",
  "data": [
    {
      "meeting_id": 1,
      "title": "we",
      "text": "<p>e</p>",
      "submitter_meeting_user_ids": [
        2
      ],
      "workflow_id": 1
    }
  ]
}

Response:

{
    "success": false,
    "message": "You are not allowed to perform action motion.create. Forbidden fields: submitter_meeting_user_ids with possibly needed permission(s): motion.can_manage, motion.can_manage_metadata"
}

Amendment:

payload: 
{
  "action": "motion.create",
  "data": [
    {
      "meeting_id": 1,
      "lead_motion_id": 11,
      "title": "Änderungsantrag zu 01",
      "submitter_meeting_user_ids": [
        2
      ],
      "workflow_id": 1,
      "reason": "",
      "amendment_paragraphs": {
        "0": "<p>s gxd.kui hg bvear ertg</p>"
      }
    }
  ]
}

response:

{
    "success": false,
    "message": "You are not allowed to perform action motion.create. Forbidden fields: submitter_meeting_user_ids with possibly needed permission(s): motion.can_manage, motion.can_manage_metadata"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove all meeting specific user info (i.e. the meeting_user object) when removing a user from a meeting

3 participants