WIP: Improve many views and a bit user permissions (idea for class scale perm)

This commit is contained in:
Skia
2015-12-08 17:22:50 +01:00
parent 475bff14cb
commit e3cbe70319
10 changed files with 116 additions and 13 deletions

View File

@ -10,12 +10,20 @@
{% block header %}
{% if user.is_authenticated %}Hello, {{ user.username }}!{% endif %}
<ul>
{% if not user.is_authenticated %}
<li><a href="{% url 'core:register' %}">Register</a></li>
<li><a href="{% url 'core:login' %}">Login</a></li>
{% else %}
<li><a href="{% url 'core:logout' %}">Logout</a></li>
{% endif %}
</ul>
{% if user.is_authenticated %}
<ul>
<li><a href="{% url 'core:user_profile' user.id %}">Profile</a></li>
<li><a href="{% url 'core:user_list' %}">Users</a></li>
<li><a href="{% url 'core:page_list' %}">Pages</a></li>
</ul>
{% endif %}
{% endblock %}
</header>

View File

@ -8,12 +8,18 @@
<h3>User Profile</h3>
<p><a href="{% url 'core:user_list' %}">Back to list</a></p>
{% if user.is_superuser or user.id == profile.id %}
{{ perms.core }}
<ul>
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
<li><a href="{% url 'core:user_groups' profile.id %}">Groups</a></li>
</ul>
{% if user.id == profile.id %}
<li><a href="{% url 'core:user_tools' %}">Tools</a></li>
{% endif %}
{% if perms.core.change_user or user.id == profile.id %}
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
{% endif %}
{% if perms.core.change_prop_user %}
<li><a href="{% url 'core:user_groups' profile.id %}">Groups</a></li>
{% endif %}
</ul>
<p>
You're seeing the profile of <strong>{{ profile.get_full_name }}</strong><br/>

View File

@ -0,0 +1,20 @@
{% extends "core/base.html" %}
{% block title %}
{{ user.get_display_name }}'s tools
{% endblock %}
{% block content %}
<h3>User Tools</h3>
<p><a href="{% url 'core:user_profile' user.id %}">Back to profile</a></p>
<ul>
{% if perms.core.add_group %}
<li><a href="{% url 'core:group_list' %}">Groups</a></li>
{% endif %}
</ul>
{% endblock %}