Skip to content

Commit

Permalink
LIST USERS should also be available from the /users/ page.
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 16, 2019
1 parent afdbc36 commit eb30f37
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 63 deletions.
141 changes: 79 additions & 62 deletions userManagment/templates/userManagment/index.html
Expand Up @@ -3,79 +3,96 @@
{% block title %}{% trans "User Functions - CyberPanel" %}{% endblock %}
{% block content %}

{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->


<div class="container">
<div id="page-title">
<h2>{% trans "User Functions" %}</h2>
<p>{% trans "Create, edit and delete users on this page." %}</p>
</div>
<div class="panel col-md-11">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Available Functions" %}
</h3>
<div class="example-box-wrapper">
<div class="row">
<div class="col-md-3 btn-min-width">
<a href="{% url 'viewProfile' %}" title="{% trans 'View Profile' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "View Profile" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-id-card"></i>
</div>
</a>
</div>
{% if type != 3 %}
<div class="col-md-3 btn-min-width">
<a href="{% url 'createUser' %}" title="{% trans 'Create User' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Create User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-user"></i>
</div>
</a>
</div>
<div class="container">
<div id="page-title">
<h2>{% trans "User Functions" %}</h2>
<p>{% trans "Create, edit and delete users on this page." %}</p>
</div>
<div class="panel col-md-11">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Available Functions" %}
</h3>
<div class="example-box-wrapper">
<div class="row">
<div class="col-md-3 btn-min-width">
<a href="{% url 'viewProfile' %}" title="{% trans 'View Profile' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "View Profile" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-id-card"></i>
</div>
</a>
</div>
{% if listUsers %}
<div class="col-md-3 btn-min-width">
<a href="{% url 'listUsers' %}" title="{% trans 'List Users' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "List Users" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-id-card"></i>
</div>
</a>
</div>
{% endif %}
{% if type != 3 %}
<div class="col-md-3 btn-min-width">
<a href="{% url 'createUser' %}" title="{% trans 'Create User' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Create User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-user"></i>
</div>
</a>
</div>

<div class="col-md-3 btn-min-width">
<a href="{% url 'modifyUsers' %}" title="{% trans 'Modify User' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Modify User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-edit"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'modifyUsers' %}" title="{% trans 'Modify User' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Modify User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-edit"></i>
</div>
</a>
</div>

{% endif %}
{% endif %}


{% if type != 3 %}
{% if type != 3 %}

<div class="col-md-3 btn-min-width">
<a href="{% url 'deleteUser' %}" title="{% trans 'Delete User' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Delete User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-trash"></i>
</div>
</a>
</div>
<div class="col-md-3 btn-min-width">
<a href="{% url 'deleteUser' %}" title="{% trans 'Delete User' %}"
class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "Delete User" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-trash"></i>
</div>
</a>
</div>

{% endif %}
{% endif %}

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>


{% endblock %}
7 changes: 6 additions & 1 deletion userManagment/views.py
Expand Up @@ -18,7 +18,12 @@ def loadUserHome(request):
val = request.session['userID']
try:
admin = Administrator.objects.get(pk=val)
return render(request, 'userManagment/index.html', {"type": admin.type})
currentACL = ACLManager.loadedACL(val)
if currentACL['admin'] == 1:
listUsers = 1
else:
listUsers = currentACL['listUsers']
return render(request, 'userManagment/index.html', {"type": admin.type, 'listUsers': listUsers})
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return HttpResponse(str(msg))
Expand Down

0 comments on commit eb30f37

Please sign in to comment.