mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
Converted manageruser functionality to new template.
This commit is contained in:
parent
c95fd6ffec
commit
f4ef99e047
@ -1,150 +1,166 @@
|
||||
{% extends "base.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/select2/select2.css') }}"/>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css') }}"/>
|
||||
<!-- END PAGE LEVEL PLUGIN STYLES -->
|
||||
|
||||
<!-- BEGIN THEME STYLES -->
|
||||
<!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag -->
|
||||
<link href="{{ url_for('static', filename='global/css/components-md.css') }}" id="style_components" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ url_for('static', filename='global/css/plugins-md.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ url_for('static', filename='admin/layout2/css/layout.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ url_for('static', filename='admin/layout2/css/themes/grey.css') }}" rel="stylesheet" type="text/css" id="style_color"/>
|
||||
<link href="{{ url_for('static', filename='admin/layout2/css/custom.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<!-- END THEME STYLES -->
|
||||
{% endblock %}
|
||||
{% block title %}<title>DNS Control Panel - User Management</title>{% endblock %}
|
||||
|
||||
{% block dashboard_stat %}
|
||||
<!-- BEGIN PAGE HEADER-->
|
||||
<h3 class="page-title">
|
||||
User Management</h3>
|
||||
<div class="page-bar">
|
||||
<ul class="page-breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-home"></i>
|
||||
<a href="{{ url_for('dashboard') }}">Home</a>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ url_for('admin') }}">Admin</a>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">User Management</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END PAGE HEADER-->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="clearfix">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- BEGIN USER MANAGEMENT -->
|
||||
<div class="portlet box blue">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
<i class="fa fa-users"></i> Users Available In Database
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse">
|
||||
</a>
|
||||
<a href="javascript:;" class="reload">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<table class="table table-striped table-hover table-bordered" id="tbl_user_manage">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Username
|
||||
</th>
|
||||
<th>
|
||||
First Name
|
||||
</th>
|
||||
<th>
|
||||
Last Name
|
||||
</th>
|
||||
<th>
|
||||
Admin
|
||||
</th>
|
||||
<th>
|
||||
Privileges
|
||||
</th>
|
||||
<th>
|
||||
Deletion
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr class="odd gradeX">
|
||||
<td>
|
||||
{{ user.username }}
|
||||
</td>
|
||||
<td>
|
||||
{{ user.firstname }}
|
||||
</td>
|
||||
<td>
|
||||
{{ user.lastname }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="md-checkbox has-error">
|
||||
<input type="checkbox" id="ck_admin_{{ user.username }}" class="md-check ck_admin" {% if user.role.name == 'Administrator' %}checked=""{% endif %}>
|
||||
<label for="ck_admin_{{ user.username }}">
|
||||
<span class="inc"></span>
|
||||
<span class="check"></span>
|
||||
<span class="box"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td width="6%">
|
||||
<a class="btn default btn-xs purple revoke" href="javascript:;"> <i class="fa fa-lock"></i>Revoke</a>
|
||||
</td>
|
||||
<td width="6%">
|
||||
<a class="btn default btn-xs red delete" href="javascript:;"> <i class="fa fa-trash-o"></i>Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END USER MANAGEMENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- MORE CONTENT GO HERE -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<!-- BEGIN PAGE LEVEL SCRIPTS -->
|
||||
<script src="{{ url_for('static', filename='global/scripts/metronic.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ url_for('static', filename='admin/layout2/scripts/layout.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ url_for('static', filename='global/plugins/bootbox/bootbox.min.js') }}" type="text/javascript"></script>
|
||||
<!-- END PAGE LEVEL SCRIPTS -->
|
||||
<!-- TABLE PLUGINS -->
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/select2/select2.min.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/media/js/jquery.dataTables.min.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='admin/pages/scripts/table-managed.js') }}"></script>
|
||||
<!-- END TABLE PLUGINS -->
|
||||
{% extends "base.html" %} {% block title %}
|
||||
<title>DNS Control Panel - User Management</title>
|
||||
{% endblock %} {% block dashboard_stat %}
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Admin <small>Manage Users</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ url_for('dashboard') }}"><i
|
||||
class="fa fa-dashboard"></i> Home</a></li>
|
||||
<li class="active">Manage Users</li>
|
||||
</ol>
|
||||
</section>
|
||||
{% endblock %} {% block content %}
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Manage Users</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table id="tbl_history" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Admin</th>
|
||||
<th>Privileges</th>
|
||||
<th>Deletion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr class="odd gradeX">
|
||||
<td>{{ user.username }}</td>
|
||||
<td>{{ user.firstname }}</td>
|
||||
<td>{{ user.lastname }}</td>
|
||||
<td>
|
||||
<input type="checkbox" id="{{ user.username }}" class="admin_toggle" {% if user.role.name=='Administrator' %}checked{% endif %}>
|
||||
</td>
|
||||
<td width="6%">
|
||||
<button type="button" class="btn btn-flat btn-warning button_revoke" id="{{ user.username }}">
|
||||
Revoke <i class="fa fa-lock"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td width="6%">
|
||||
<button type="button" class="btn btn-flat btn-danger button_delete" id="{{ user.username }}">
|
||||
Delete <i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% block extrascripts %}
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
Metronic.init(); // init metronic core componets
|
||||
Layout.init(); // init layout
|
||||
TableManaged.init();
|
||||
});
|
||||
// handle revocation of privileges
|
||||
$('.button_revoke').click(function() {
|
||||
var modal = $("#modal_revoke");
|
||||
var username = $(this).prop('id');
|
||||
var info = "Are you sure you want to revoke all privileges for " + username + ". They will not able to access any domain.";
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.find('#button_revoke_confirm').click(function() {
|
||||
var postdata = {'action': 'revoke_user_privielges', 'data': username}
|
||||
applyChanges(postdata, '/admin/manageuser');
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.modal('show');
|
||||
});
|
||||
// handle deletion of user
|
||||
$('.button_delete').click(function() {
|
||||
var modal = $("#modal_delete");
|
||||
var username = $(this).prop('id');
|
||||
var info = "Are you sure you want to delete " + username + "?";
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.find('#button_delete_confirm').click(function() {
|
||||
var postdata = {'action': 'delete_user', 'data': username}
|
||||
applyChanges(postdata, '/admin/manageuser');
|
||||
modal.modal('hide');
|
||||
location.reload();
|
||||
})
|
||||
modal.modal('show');
|
||||
|
||||
});
|
||||
|
||||
// initialize pretty checkboxes
|
||||
$('.admin_toggle').iCheck({
|
||||
checkboxClass : 'icheckbox_square-blue',
|
||||
increaseArea : '20%' // optional
|
||||
});
|
||||
|
||||
// handle checkbox toggling
|
||||
$('.admin_toggle').on('ifToggled', function(event) {
|
||||
var is_admin = $(this).prop('checked');
|
||||
var username = $(this).prop('id');
|
||||
postdata = {
|
||||
'action' : 'set_admin',
|
||||
'data' : {
|
||||
'username' : username,
|
||||
'is_admin' : is_admin
|
||||
}
|
||||
};
|
||||
applyChanges(postdata, '/admin/manageuser');
|
||||
});
|
||||
</script>
|
||||
<!-- END JAVASCRIPTS -->
|
||||
{% endblock %}
|
||||
{% block modals %}
|
||||
<div class="modal fade modal-warning" id="modal_revoke">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">Confirmation</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left"
|
||||
data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-danger" id="button_revoke_confirm">Revoke</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
<div class="modal fade modal-warning" id="modal_delete">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">Confirmation</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left"
|
||||
data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-danger" id="button_delete_confirm">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user