Added extra permission check to speaker widget, fixed #1191 only for 1.5.x branch

This commit is contained in:
Norman Jäckel 2014-03-07 18:57:03 +01:00
parent 8866ee4d63
commit 39de1924cb
3 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,8 @@ Version 1.5.1 (unreleased)
==========================
[https://github.com/OpenSlides/OpenSlides/issues?milestone=15]
Agenda:
- Fixed permission error in list of speakers widget.
Participant:
- Added permission to see participants also to the manager group.
Files:

View File

@ -669,6 +669,6 @@ def get_widgets(request):
name='append_to_list_of_speakers',
display_name=_('List of speakers'),
template='agenda/speaker_widget.html',
permission_required='agenda.can_be_speaker',
permission_required=('agenda.can_be_speaker', 'agenda.can_manage_agenda'), # Short hack only for OpenSlides >=1.5.1, <1.6.0
default_column=1,
default_weight=30)]

View File

@ -250,6 +250,11 @@ def get_all_widgets(request, session=False):
session_widgets = request.session.get('widgets', {})
widgets = SortedDict()
for widget in all_module_widgets:
if isinstance(widget.permission_required, tuple):
for perm in widget.permission_required:
if request.user.has_perm(perm):
widget.permission_required = None
break
if (widget.permission_required is None or
request.user.has_perm(widget.permission_required)):
if not session or session_widgets.get(widget.get_name(), True):