mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-06-14 12:06:06 +00:00
Provision PDA user privileges based On LDAP Attributes (#980)
This commit is contained in:

committed by
GitHub

parent
32983635c6
commit
6e04d0419b
@ -84,7 +84,7 @@
|
||||
<select multiple="multiple" class="form-control" id="account_multi_user"
|
||||
name="account_multi_user">
|
||||
{% for user in users %}
|
||||
<option {% if user.id in account_user_ids %}selected{% endif %}
|
||||
<option {% if user.id in account_user_ids|default([]) %}selected{% endif %}
|
||||
value="{{ user.username }}">{{ user.username }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
@ -73,11 +73,19 @@
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-flat btn-primary">Save</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane active" id="tabs-ldap">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> Error!</h4>
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<form role="form" method="post" data-toggle="validator">
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
||||
<input type="hidden" value="ldap" name="config_tab" />
|
||||
@ -186,6 +194,46 @@
|
||||
<span class="help-block with-errors"></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>ADVANCE</legend>
|
||||
<div class="form-group">
|
||||
<label>Roles Autoprovisioning</label>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="autoprovisioning" id="autoprovisioning_off" value="OFF" {% if not SETTING.get('autoprovisioning') %}checked{% endif %}> OFF
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" name="autoprovisioning" id="autoprovisioning_on" value="ON"
|
||||
|
||||
{% if SETTING.get('autoprovisioning') %}checked{% endif %}> ON
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="autoprovisioning_attribute">Roles provisioning field</label>
|
||||
<input type="text" class="form-control" name="autoprovisioning_attribute" id="autoprovisioning_attribute" placeholder="e.g. eduPersonEntitlement" data-error=" Please input field responsible for autoprovisioning" value="{{ SETTING.get('autoprovisioning_attribute') }}">
|
||||
<span class="help-block with-errors"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group {% if error %}has-error{% endif %}">
|
||||
<label for="urn_value">Urn prefix</label>
|
||||
<input type="text" class="form-control" name="urn_value" id="urn_value" placeholder="e.g. urn:mace:<yourOrganization>" data-error="Please fill this field" value="{{ SETTING.get('urn_value') }}">
|
||||
{% if error %}
|
||||
<span class="help-block with-errors">Please input the correct prefix for your urn value</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Purge Roles If Empty</label>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="purge" id="purge_off" value="OFF" {% if not SETTING.get('purge') %}checked{% endif %}> OFF
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" name="purge" id="purge_on" value="ON" {% if SETTING.get('purge') %}checked{% endif %}> ON
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-flat btn-primary">Save</button>
|
||||
</div>
|
||||
@ -261,6 +309,24 @@
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>ADVANCE</dt>
|
||||
<dd> Provision PDA user privileges based on LDAP Object Attributes. Alternative to Group Security Role Management.
|
||||
<ul>
|
||||
<li>
|
||||
Roles Autoprovisioning - If toggled on, the PDA Role and the associations of users found in the local db, will be instantly updated from the LDAP server every time they log in.
|
||||
</li>
|
||||
<li>
|
||||
Roles provisioning field - The attribute in the ldap server populated by the urn values where PDA will look for a new Role and/or new associations to domains/accounts.
|
||||
</li>
|
||||
<li>
|
||||
Urn prefix - The prefix used before the static keyword "powerdns-admin" for your entitlements in the ldap server. Must comply with RFC no.8141.
|
||||
</li>
|
||||
<li>
|
||||
Purge Roles If Empty - If toggled on, ldap entries that have no valid "powerdns-admin" records to their autoprovisioning field, will lose all their associations with any domain or account, also reverting to a User in the process, despite their current role in the local db.<br> If toggled off, in the same scenario they get to keep their existing associations and their current Role.
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@ -625,7 +691,7 @@
|
||||
{%- endassets %}
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$(function() {
|
||||
$('#tabs').tabs({
|
||||
// add url anchor tags
|
||||
@ -648,6 +714,11 @@
|
||||
checkboxClass : 'icheckbox_square-blue',
|
||||
increaseArea : '20%'
|
||||
})
|
||||
|
||||
$('#autoprovisioning').iCheck({
|
||||
checkboxClass : 'icheckbox_square-blue',
|
||||
increaseArea : '20%'
|
||||
})
|
||||
// END: General tab js
|
||||
|
||||
// START: LDAP tab js
|
||||
@ -679,7 +750,10 @@
|
||||
$('#ldap_operator_group').prop('required', true);
|
||||
$('#ldap_user_group').prop('required', true);
|
||||
}
|
||||
|
||||
if ($('#autoprovisioning').is(":checked")) {
|
||||
$('#autoprovisioning_attribute').prop('required', true);
|
||||
$('#urn_value').prop('required', true);
|
||||
}
|
||||
} else {
|
||||
$('#ldap_uri').prop('required', false);
|
||||
$('#ldap_base_dn').prop('required', false);
|
||||
@ -695,6 +769,10 @@
|
||||
$('#ldap_operator_group').prop('required', false);
|
||||
$('#ldap_user_group').prop('required', false);
|
||||
}
|
||||
if ($('#autoprovisioning').is(":checked")) {
|
||||
$('#autoprovisioning_attribute').prop('required', false);
|
||||
$('#urn_value').prop('required', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -708,8 +786,75 @@
|
||||
$('#ldap_operator_group').prop('required', false);
|
||||
$('#ldap_user_group').prop('required', false);
|
||||
}
|
||||
|
||||
if ($('#ldap_sg_on').is(":checked") && $('#autoprovisioning_on').is(":checked")){
|
||||
document.getElementById('ldap_sg_on').checked=false;
|
||||
document.getElementById('ldap_sg_off').checked=true;
|
||||
var modal = $("#modal_warning");
|
||||
|
||||
var info = "Group Security:Status and Advance:Autoprovisioning can not be both enabled at the same time. Please turn off Advance:Autoprovisioning first" ;
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.find('#button_warning_confirm').click(function () {
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.find('#warning_X').click(function () {
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.modal('show');
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='autoprovisioning']" ).change(function(){
|
||||
if ($('#autoprovisioning_on').is(":checked") && $('#ldap_enabled').is(":checked")) {
|
||||
$('#autoprovisioning_attribute').prop('required', true);
|
||||
$('#urn_value').prop('required', true);
|
||||
$('#purge').prop('required', true);
|
||||
}
|
||||
else{
|
||||
$('#autoprovisioning_attribute').prop('required', false);
|
||||
$('#urn_value').prop('required', false);
|
||||
$('#purge').prop('required', false);
|
||||
}
|
||||
if ($('#ldap_sg_on').is(":checked") && $('#autoprovisioning_on').is(":checked")){
|
||||
document.getElementById('autoprovisioning_on').checked=false;
|
||||
document.getElementById('autoprovisioning_off').checked=true;
|
||||
var modal = $("#modal_warning");
|
||||
var info = "Group Security:Status and Advance:Autoprovisioning can not be both enabled at the same time. Please turn off Group Security:Status first" ;
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.find('#button_warning_confirm').click(function () {
|
||||
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.find('#warning_X').click(function () {
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.modal('show');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='purge']" ).change(function(){
|
||||
if ($("#purge_on").is(":checked")){
|
||||
document.getElementById('purge_on').checked=false;
|
||||
document.getElementById('purge_off').checked=true;
|
||||
var modal = $("#modal_confirm");
|
||||
var info = "Are you sure you want to do this? Users will lose their associated domains unless they already have their autoprovisioning field prepopulated." ;
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.find('#button_confirm').click(function () {
|
||||
document.getElementById('purge_on').checked=true;
|
||||
document.getElementById('purge_off').checked=false;
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.find('#button_cancel').click(function () {
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.find('#X').click(function () {
|
||||
modal.modal('hide');
|
||||
})
|
||||
modal.modal('show');
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='ldap_type']" ).change(function(){
|
||||
if ($('#ldap').is(":checked") && $('#ldap_enabled').is(":checked")) {
|
||||
$('#ldap_admin_group').prop('required', true);
|
||||
@ -747,7 +892,14 @@
|
||||
$('#ldap_operator_group').prop('required', true);
|
||||
$('#ldap_user_group').prop('required', true);
|
||||
}
|
||||
|
||||
if ($('#autoprovisioning_on').is(":checked")) {
|
||||
$('#autoprovisioning_attribute').prop('required', true);
|
||||
$('#urn_value').prop('required', true);
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
|
||||
// END: LDAP tab js
|
||||
|
||||
// START: Google tab js
|
||||
@ -900,3 +1052,51 @@
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block modals %}
|
||||
<div class="modal fade modal-warning" id="modal_confirm" data-keyboard="false" data-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="X" >
|
||||
<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" id="button_cancel" name="purge" value="OFF" data-dismiss="modal" >Cancel</button>
|
||||
<button type="button" class="btn btn-flat btn-success" id="button_confirm">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade modal-warning" id="modal_warning" data-keyboard="false" data-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="warning_X" >
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">Warning</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-flat btn-success" id="button_warning_confirm">Yes I understand</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user