mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 01:20:27 +00:00
a3a58f16a5
This adds initial support for accounts a concept meant to signify a customer, a department or any other entity that somehow owns or manages one or more domains. The purpose is to be able to assign an account to any number of domains, making it easy to track who owns or manages a domain, significantly improving manageability in setups with a large number of domains. An account consists of a mandatory, unique `name` and optional `description`, `contact` name and `mail` address. The account `name` is stripped of spaces and symbols, and lower cased before getting stored in the database and in PowerDNS, to help ensure some type of predictability and uniqueness in the database. The term *account* is actually taken from the PowerDNS database, where the `domains.account` column is used to store the account relationship, in in the form of the account `name`. The link to a domain in PowerDNS-Admin is done through the `domain.account_id` FOREIGN KEY, that is linked to the `account.id` PRIMARY KEY. (cherry picked from commits 4e95f33dfb0676d1c401a033c28bca3be7d6ec26, da0d596bd019a339549e2c59630a8fdee65d0e22, 7f06e6aaf4fd8011c784f24b7bbbba5f52aef319, 1c624dad8749024033d1d15dd6242ca52b39f135)
128 lines
4.9 KiB
HTML
128 lines
4.9 KiB
HTML
{% extends "base.html" %} {% block title %}
|
|
<title>DNS Control Panel - Account Management</title>
|
|
{% endblock %} {% block dashboard_stat %}
|
|
<section class="content-header">
|
|
<h1>
|
|
Accounts <small>Manage accounts</small>
|
|
</h1>
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ url_for('dashboard') }}"><i
|
|
class="fa fa-dashboard"></i> Home</a></li>
|
|
<li class="active">Accounts</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">Account Management</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<a href="{{ url_for('admin_editaccount') }}">
|
|
<button type="button" class="btn btn-flat btn-primary pull-left button_add_account">
|
|
Add Account <i class="fa fa-plus"></i>
|
|
</button>
|
|
</a>
|
|
</div>
|
|
<div class="box-body">
|
|
<table id="tbl_accounts" class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
<th>Contact</th>
|
|
<th>Mail</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for account in accounts %}
|
|
<tr class="odd gradeX">
|
|
<td>{{ account.name }}</td>
|
|
<td>{{ account.description }}</td>
|
|
<td>{{ account.contact }}</td>
|
|
<td>{{ account.mail }}</td>
|
|
<td width="15%">
|
|
<button type="button" class="btn btn-flat btn-success" onclick="window.location.href='{{ url_for('admin_editaccount', account_name=account.name) }}'">
|
|
Edit <i class="fa fa-cog"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-flat btn-danger button_delete" id="{{ account.name }}">
|
|
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>
|
|
// set up accounts data table
|
|
$("#tbl_accounts").DataTable({
|
|
"paging" : true,
|
|
"lengthChange" : true,
|
|
"searching" : true,
|
|
"ordering" : true,
|
|
"columnDefs": [
|
|
{ "orderable": false, "targets": [-1] }
|
|
],
|
|
"info" : false,
|
|
"autoWidth" : false,
|
|
"lengthMenu": [ [10, 25, 50, 100, -1],
|
|
[10, 25, 50, 100, "All"]],
|
|
"pageLength": 10
|
|
});
|
|
|
|
// handle deletion of account
|
|
$(document.body).on('click', '.button_delete', function() {
|
|
var modal = $("#modal_delete");
|
|
var accountname = $(this).prop('id');
|
|
var info = "Are you sure you want to delete " + accountname + "?";
|
|
modal.find('.modal-body p').text(info);
|
|
modal.find('#button_delete_confirm').click(function() {
|
|
var postdata = {'action': 'delete_account', 'data': accountname}
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageaccount', false, true);
|
|
modal.modal('hide');
|
|
})
|
|
modal.modal('show');
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|
|
{% block modals %}
|
|
<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-flat btn-default pull-left"
|
|
data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-flat btn-danger" id="button_delete_confirm">Delete</button>
|
|
</div>
|
|
</div>
|
|
<!-- /.modal-content -->
|
|
</div>
|
|
<!-- /.modal-dialog -->
|
|
</div>
|
|
{% endblock %}
|