Merge pull request #2966 from emanuelschuetze/issue2956
Send only data to client which user is allowed to see (Fixed #2956).
This commit is contained in:
commit
be342f752f
@ -25,8 +25,8 @@ class MediafileAccessPermissions(BaseAccessPermissions):
|
|||||||
Returns the restricted serialized data for the instance prepared
|
Returns the restricted serialized data for the instance prepared
|
||||||
for the user.
|
for the user.
|
||||||
"""
|
"""
|
||||||
if (not full_data['hidden'] or has_perm(user, 'mediafiles.can_see_hidden')):
|
data = None
|
||||||
data = full_data
|
if has_perm(user, 'mediafiles.can_see'):
|
||||||
else:
|
if (not full_data['hidden'] or has_perm(user, 'mediafiles.can_see_hidden')):
|
||||||
data = None
|
data = full_data
|
||||||
return data
|
return data
|
||||||
|
@ -47,23 +47,23 @@ class MotionAccessPermissions(BaseAccessPermissions):
|
|||||||
is_submitter = False
|
is_submitter = False
|
||||||
|
|
||||||
required_permission_to_see = full_data['state_required_permission_to_see']
|
required_permission_to_see = full_data['state_required_permission_to_see']
|
||||||
if (not required_permission_to_see or
|
data = None
|
||||||
has_perm(user, required_permission_to_see) or
|
if has_perm(user, 'motions.can_see'):
|
||||||
has_perm(user, 'motions.can_manage') or
|
if (not required_permission_to_see or
|
||||||
is_submitter):
|
has_perm(user, required_permission_to_see) or
|
||||||
if has_perm(user, 'motions.can_see_and_manage_comments') or not full_data.get('comments'):
|
has_perm(user, 'motions.can_manage') or
|
||||||
data = full_data
|
is_submitter):
|
||||||
else:
|
if has_perm(user, 'motions.can_see_and_manage_comments') or not full_data.get('comments'):
|
||||||
data = deepcopy(full_data)
|
data = full_data
|
||||||
for i, field in enumerate(config['motions_comments']):
|
else:
|
||||||
if not field.get('public'):
|
data = deepcopy(full_data)
|
||||||
try:
|
for i, field in enumerate(config['motions_comments']):
|
||||||
data['comments'][i] = None
|
if not field.get('public'):
|
||||||
except IndexError:
|
try:
|
||||||
# No data in range. Just do nothing.
|
data['comments'][i] = None
|
||||||
pass
|
except IndexError:
|
||||||
else:
|
# No data in range. Just do nothing.
|
||||||
data = None
|
pass
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_projector_data(self, full_data):
|
def get_projector_data(self, full_data):
|
||||||
|
Loading…
Reference in New Issue
Block a user