Updated permissions.

This commit is contained in:
Emanuel Schuetze 2011-09-04 12:21:58 +02:00
parent 85d74683e8
commit d1d0e7e9b4
15 changed files with 50 additions and 51 deletions

View File

@ -176,9 +176,9 @@ class Item(InheritanceCastModel):
class Meta:
permissions = (
('can_view_agenda', "Can see the agenda"),
('can_manage_agenda', "Can manage the agenda and its items"),
('can_see_beamer', "Can see the Beamer"),
('can_see_agenda', "Can see agenda"),
('can_manage_agenda', "Can manage agenda"),
('can_see_beamer', "Can see projector"),
)

View File

@ -130,7 +130,7 @@ def assignment_votes(item):
return votes
@permission_required('agenda.can_view_agenda')
@permission_required('agenda.can_see_agenda')
@template('agenda/overview.html')
def overview(request):
"""

View File

@ -396,10 +396,10 @@ class Application(models.Model):
class Meta:
permissions = (
('can_view_application', _("Can see applications")),
('can_insert_application', _("Can insert new applications")),
('can_support_application', _("Can support applications")),
('can_manage_application', _("Can manage applications")),
('can_see_application', "Can see application"),
('can_create_application', "Can create application"),
('can_support_application', "Can support application"),
('can_manage_application', "Can manage application"),
)

View File

@ -6,7 +6,7 @@
<h4>{%trans "Applications" %}</h4>
<ul>
<li class="{% if request.path == url_applicationoverview %}selected{% endif %}"><a href="{% url application_overview %}">{%trans "All applications" %}</a></li>
{% if perms.application.can_insert_application or perms.application.can_manage_application %}
{% if perms.application.can_create_application or perms.application.can_manage_application %}
<li class="{% active request '/application/new' %}"><a href="{% url application_new %}">{%trans "New application" %}</a></li>
{% endif %}
<li><a href="{% url print_applications %}"><img src="/static/images/icons/application-pdf.png"> {%trans 'Print all applications' %}</a></li>

View File

@ -27,7 +27,7 @@ from openslides.utils.pdf import print_application, print_application_poll
from openslides.system.api import config_get
@permission_required('application.can_view_application')
@permission_required('application.can_see_application')
@template('application/overview.html')
def overview(request):
"""
@ -61,7 +61,7 @@ def overview(request):
}
@permission_required('application.can_view_application')
@permission_required('application.can_see_application')
@template('application/view.html')
def view(request, application_id):
"""
@ -91,8 +91,8 @@ def edit(request, application_id=None):
is_manager = False
if not is_manager \
and not request.user.has_perm('application.can_insert_application'):
messages.error(request, _("You have not the necessary rights to edit or insert applications."))
and not request.user.has_perm('application.can_create_application'):
messages.error(request, _("You have not the necessary rights to create or edit applications."))
return redirect(reverse('application_overview'))
if application_id is not None:
application = Application.objects.get(id=application_id)

View File

@ -130,9 +130,8 @@ class Assignment(models.Model):
class Meta:
permissions = (
('can_view_assignment', "Can see the assignments"),
('can_nominate_other', "Can nominate another person"
" for a election"),
('can_nominate_self', "Can nominate hisself for a election"),
('can_manage_assignment', "Can manage assignments"),
('can_see_assignment', "Can see assignment"),
('can_nominate_other', "Can nominate another person"),
('can_nominate_self', "Can nominate themselves"),
('can_manage_assignment', "Can manage assignment"),
)

View File

@ -91,7 +91,7 @@
{% for field in form %}
<label>{{ field.label }}:</label>
<nobr>{{ field }}
{% if perms.participant.can_view_participants and perms.participant.can_manage_participants %}
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
<a href="{% url user_new %}"><img src="/static/images/icons/list-add-user.png" title="{% trans 'Add new participant' %}"></a>
{% endif %}
</nobr>

View File

@ -25,7 +25,7 @@ from utils.pdf import print_assignment_poll
from participant.models import Profile
@permission_required('assignment.can_view_assignment')
@permission_required('assignment.can_see_assignment')
@template('assignment/overview.html')
def get_overview(request):
query = Assignment.objects
@ -46,7 +46,7 @@ def get_overview(request):
}
@permission_required('assignment.can_view_assignment')
@permission_required('assignment.can_see_assignment')
@template('assignment/view.html')
def view(request, assignment_id=None):
form = None

View File

@ -49,8 +49,8 @@ class Profile(models.Model):
class Meta:
permissions = (
('can_view_participants', "Can see the list of participants"),
('can_manage_participants', "Can manage the participant list"),
('can_see_participant', "Can see participant"),
('can_manage_participant', "Can manage participant"),
)
def set_first_user_passwords():

View File

@ -5,15 +5,15 @@
{% url user_overview as url_useroverview %}
<h4 class="sectiontitle">{%trans "Participants" %}</h4>
<ul>
{% if perms.participant.can_view_participants %}
{% if perms.participant.can_see_participant %}
<li class="{% if request.path == url_useroverview %}selected{% endif %}"><a href="{% url user_overview %}">{%trans "All participants" %}</a></li>
{% endif %}
{% if perms.participant.can_manage_participants %}
{% if perms.participant.can_manage_participant %}
<li class="{% active request '/user/new' %}"><a href="{% url user_new %}">{%trans "New participant" %}</a></li>
<li><a href="{% url user_group_overview %}">{%trans "All user groups" %}</a></li>
<li><a href="{% url user_group_new %}">{%trans "New user group" %}</a></li>
<li><a href="{% url user_print %}"><img src="/static/images/icons/application-pdf.png"> {%trans 'Print participant list' %}</a></li>
<li><a href="{% url user_import %}"> {%trans 'Import' %}</a></li>
<li><a href="{% url user_import %}"> {%trans 'Import participant' %}</a></li>
<li><a href="{% url user_gen_passwords %}">{% trans 'Generate first passwords' %}</a></li>
<li><a href="{% url print_passwords %}"><img src="/static/images/icons/application-pdf.png"> {% trans 'Print password list' %}</a></li>
{% endif %}

View File

@ -42,7 +42,7 @@
<th><a href="?sort=last_name{% if 'last_name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Last Name" %}</a></th>
<th><a href="?sort=group{% if 'group' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Group" %}</a></th>
<th><a href="?sort=committee{% if 'committee' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Committee" %}</a></th>
{% if perms.participant.can_manage_participants %}
{% if perms.participant.can_manage_participant %}
<th><a href="?sort=type{% if 'type' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Type" %}</a></th>
<th><a href="?sort=username{% if 'username' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Username" %}</a></th>
<th><a href="?sort=email{% if 'email' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Email" %}</a></th>
@ -56,7 +56,7 @@
<td>{{ user.last_name }}</td>
<td>{{ user.profile.group }}</td>
<td>{{ user.profile.committee }}</td>
{% if perms.participant.can_manage_participants %}
{% if perms.participant.can_manage_participant %}
<td>{{ user.profile.type }}</td>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>

View File

@ -30,7 +30,7 @@ from utils.pdf import print_userlist, print_passwords
from django.db.models import Avg, Max, Min, Count
@permission_required('participant.can_view_participants')
@permission_required('participant.can_see_participant')
@template('participant/overview.html')
def get_overview(request):
query = User.objects
@ -69,7 +69,7 @@ def get_overview(request):
'committees': committees,
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('participant/edit.html')
def edit(request, user_id=None):
"""
@ -120,7 +120,7 @@ def edit(request, user_id=None):
'edituser': user,
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('confirm.html')
def user_delete(request, user_id):
user = User.objects.get(pk=user_id)
@ -131,7 +131,7 @@ def user_delete(request, user_id):
gen_confirm_form(request, _('Do you really want to delete <b>%s</b>?') % user, reverse('user_delete', args=[user_id]))
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('confirm.html')
def user_set_superuser(request, user_id):
user = User.objects.get(pk=user_id)
@ -145,7 +145,7 @@ def user_set_superuser(request, user_id):
messages.success(request, _('Participant <b>%s</b> is now administrator.') % user)
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('confirm.html')
def user_set_active(request, user_id):
user = User.objects.get(pk=user_id)
@ -159,7 +159,7 @@ def user_set_active(request, user_id):
messages.success(request, _('Participant <b>%s</b> was successfully activated.') % user)
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('participant/group_overview.html')
def get_group_overview(request):
groups = Group.objects.all()
@ -167,7 +167,7 @@ def get_group_overview(request):
'groups': groups,
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('participant/group_edit.html')
def group_edit(request, group_id=None):
if group_id is not None:
@ -199,7 +199,7 @@ def group_edit(request, group_id=None):
'group': group,
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
def group_delete(request, group_id):
group = Group.objects.get(pk=group_id)
if request.method == 'POST':
@ -231,7 +231,7 @@ def user_settings(request):
'edituser': request.user,
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
@template('participant/import.html')
def user_import(request):
try:
@ -277,13 +277,13 @@ def user_import(request):
}
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
def gen_passwords(request):
set_first_user_passwords()
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
def reset_password(request, user_id):
user = User.objects.get(pk=user_id)
if request.method == 'POST':

View File

@ -29,5 +29,5 @@ class Config(models.Model):
class Meta:
permissions = (
('can_manage_system', "Can manage the system"),
('can_manage_system', "Can manage system configuration"),
)

View File

@ -31,20 +31,20 @@
<div id="mainmenu">
{% block mainmenu %}
<ul>
{% if perms.agenda.can_view_agenda or perms.agenda.can_manage_agenda %}
{% if perms.agenda.can_see_agenda or perms.agenda.can_manage_agenda %}
<li class="{% active request '/item' %}
{% if request.path == '/'%}selected{% endif %}">
<a href="{% url item_overview %}" title="">{%trans "Agenda" %}</a></li>
{% endif %}
{% if perms.application.can_view_application or perms.application.can_insert_application or perms.application.can_support_application or perms.application.can_manage_application %}
{% if perms.application.can_see_application or perms.application.can_create_application or perms.application.can_support_application or perms.application.can_manage_application %}
<li class="{% active request '/application' %}">
<a href="{% url application_overview %}" title="">{%trans "Applications" %}</a></li>
{% endif %}
{% if perms.assignment.can_view_assignment or perms.assignment.can_nominate_other or perms.assignment.can_nominate_self or perms.assignment.can_manage_assignment %}
{% if perms.assignment.can_see_assignment or perms.assignment.can_nominate_other or perms.assignment.can_nominate_self or perms.assignment.can_manage_assignment %}
<li class="{% active request '/assignment' %}">
<a href="{% url assignment_overview %}" title="">{%trans "Elections" %}</a></li>
{% endif %}
{% if perms.participant.can_view_participants or perms.participant.can_manage_participants %}
{% if perms.participant.can_see_participant or perms.participant.can_manage_participant %}
<li class="{% active request '/participant' %}">
<a href="{% url user_overview %}" title="">{%trans "Participants" %}</a></li>
{% endif %}

View File

@ -201,7 +201,7 @@ def laterPages(canvas, doc):
canvas.drawString(10*cm, 1*cm, _("Page")+" %s" % doc.page)
canvas.restoreState()
@permission_required('agenda.can_view_agenda')
@permission_required('agenda.can_see_agenda')
def print_agenda(request):
response = HttpResponse(mimetype='application/pdf')
filename = u'filename=%s.pdf;' % _("Agenda")
@ -224,7 +224,7 @@ def print_agenda(request):
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
return response
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
def print_userlist(request):
response = HttpResponse(mimetype='application/pdf')
filename = u'filename=%s.pdf;' % _("Participant-list")
@ -265,7 +265,7 @@ def print_userlist(request):
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
return response
@permission_required('participant.can_manage_participants')
@permission_required('participant.can_manage_participant')
def print_passwords(request):
response = HttpResponse(mimetype='application/pdf')
filename = u'filename=%s.pdf;' % _("passwords")
@ -281,7 +281,7 @@ def print_passwords(request):
user.get_profile()
cell = []
cell.append(Spacer(0,0.8*cm))
cell.append(Paragraph(_("Your Password for OpenSlides"), stylesheet['Ballot_title']))
cell.append(Paragraph(_("Your Account for OpenSlides"), stylesheet['Ballot_title']))
cell.append(Paragraph("%s %s %s" % (_("for"), user.first_name, user.last_name), stylesheet['Ballot_subtitle']))
cell.append(Spacer(0,0.5*cm))
cell.append(Paragraph("%s: %s" % (_("Username"), user.username), stylesheet['Ballot_option']))
@ -308,7 +308,7 @@ def print_passwords(request):
doc.build(story)
return response
@permission_required('application.can_view_application')
@permission_required('application.can_see_application')
def get_application(application, story):
if application.number is None:
story.append(Paragraph(_("Application")+" #[-]", stylesheet['Heading1']))
@ -333,7 +333,7 @@ def get_application(application, story):
story.append(Paragraph(_("Status")+": %s" % (application.get_status_display()), stylesheet['Italic']))
return story
@permission_required('application.can_view_application')
@permission_required('application.can_see_application')
def print_application(request, application_id=None):
response = HttpResponse(mimetype='application/pdf')
filename = u'filename=%s.pdf;' % _("Applications")