Fixed motion state and restriction

- Fixed restriction check for motions
- Send users via autoupdate on statechanges
This commit is contained in:
FinnStutzenstein 2019-04-26 13:03:10 +02:00
parent 395dfaf63f
commit 7cfe22436e
2 changed files with 14 additions and 2 deletions

View File

@ -46,10 +46,12 @@ class MotionAccessPermissions(BaseAccessPermissions):
if not permission:
# Parse values of restriction field.
# If at least one restriction is ok, permissions are granted.
for value in restriction:
if value == "managers_only":
# permission remains false
break
# permission remains false, becuase the user does not
# have this permission (see above); continue to check other fields
continue
elif value in (
"motions.can_see_internal",
"motions.can_manage_metadata",

View File

@ -568,6 +568,11 @@ class MotionViewSet(TreeSortMixin, ModelViewSet):
)
message = f"The state of the motion was set to {motion.state.name}."
# Send submitters and supporters via autoupdate because users without
# users.can_see may see them now.
inform_changed_data(map(lambda s: s.user, motion.submitters.all()))
inform_changed_data(motion.supporters.all())
# Fire autoupdate again to save information to OpenSlides history.
inform_changed_data(
motion,
@ -642,6 +647,11 @@ class MotionViewSet(TreeSortMixin, ModelViewSet):
skip_autoupdate=True,
)
# Send submitters and supporters via autoupdate because users without
# users.can_see may see them now.
inform_changed_data(map(lambda s: s.user, motion.submitters.all()))
inform_changed_data(motion.supporters.all())
# Fire autoupdate again to save information to OpenSlides history.
inform_changed_data(
motion,