Merge pull request #4638 from FinnStutzenstein/fixRestrictionCheck

Fix restriction check for motions
This commit is contained in:
Emanuel Schütze 2019-04-26 21:35:09 +02:00 committed by GitHub
commit 78c77efd7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -46,10 +46,12 @@ class MotionAccessPermissions(BaseAccessPermissions):
if not permission: if not permission:
# Parse values of restriction field. # Parse values of restriction field.
# If at least one restriction is ok, permissions are granted.
for value in restriction: for value in restriction:
if value == "managers_only": if value == "managers_only":
# permission remains false # permission remains false, becuase the user does not
break # have this permission (see above); continue to check other fields
continue
elif value in ( elif value in (
"motions.can_see_internal", "motions.can_see_internal",
"motions.can_manage_metadata", "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}." 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. # Fire autoupdate again to save information to OpenSlides history.
inform_changed_data( inform_changed_data(
motion, motion,
@ -642,6 +647,11 @@ class MotionViewSet(TreeSortMixin, ModelViewSet):
skip_autoupdate=True, 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. # Fire autoupdate again to save information to OpenSlides history.
inform_changed_data( inform_changed_data(
motion, motion,