Compare commits
2 Commits
7513ed6def
...
bb9374ec01
Author | SHA1 | Date | |
---|---|---|---|
bb9374ec01 | |||
c0e6b62ee5 |
@ -116,8 +116,9 @@ class HomeController extends Controller
|
|||||||
{
|
{
|
||||||
$dn = Crypt::decryptString($id);
|
$dn = Crypt::decryptString($id);
|
||||||
$o = config('server')->fetch($dn);
|
$o = config('server')->fetch($dn);
|
||||||
|
$oc = $o->getObject('objectclass');
|
||||||
|
|
||||||
$ocs = $o->getObject('objectclass')
|
$ocs = $oc
|
||||||
->structural
|
->structural
|
||||||
->map(fn($item)=>$item->getParents())
|
->map(fn($item)=>$item->getParents())
|
||||||
->flatten()
|
->flatten()
|
||||||
@ -125,6 +126,8 @@ class HomeController extends Controller
|
|||||||
config('server')->schema('objectclasses')
|
config('server')->schema('objectclasses')
|
||||||
->filter(fn($item)=>$item->isAuxiliary())
|
->filter(fn($item)=>$item->isAuxiliary())
|
||||||
)
|
)
|
||||||
|
// Remove the original objectlcasses
|
||||||
|
->filter(fn($item)=>(! $oc->values->contains($item)))
|
||||||
->sortBy(fn($item)=>$item->name);
|
->sortBy(fn($item)=>$item->name);
|
||||||
|
|
||||||
return $ocs->groupBy(fn($item)=>$item->isStructural())
|
return $ocs->groupBy(fn($item)=>$item->isStructural())
|
||||||
|
2
public/css/fixes.css
vendored
2
public/css/fixes.css
vendored
@ -297,7 +297,7 @@ select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#objectclass .input-group-delete {
|
div#objectClass .input-group-delete {
|
||||||
position: relative;
|
position: relative;
|
||||||
float: inline-end;
|
float: inline-end;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<!-- CSRF Token -->
|
<!-- CSRF Token -->
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
<title>{{ config('app.name') }} - @yield('htmlheader_title','🥇 The BEST ldap admin tool!')</title>
|
<title>{{ config('app.name') }} - @yield('htmlheader_title','🥇 An LDAP Administration Tool')</title>
|
||||||
<link rel="shortcut icon" href="/{{ config('app.favicon','favicon.ico') }}" />
|
<link rel="shortcut icon" href="/{{ config('app.favicon','favicon.ico') }}" />
|
||||||
|
|
||||||
<!-- App CSS -->
|
<!-- App CSS -->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="row pt-2">
|
<div class="row pt-2">
|
||||||
<div @class(['col-1','d-none'=>(! $edit)])></div>
|
<div @class(['col-1','d-none'=>(! $edit)])></div>
|
||||||
<div class="col-10 p-2">
|
<div class="col-10 p-2">
|
||||||
<div id="{{ $o->name_lc }}">
|
<div id="{{ $o->name }}">
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,11 +39,14 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var added_oc = []; // Object classes being added to this entry
|
var added_oc = []; // Object classes being added to this entry
|
||||||
|
var rendered = false;
|
||||||
|
|
||||||
// Show our ObjectClass modal so that we can add more objectclasses
|
// Show our ObjectClass modal so that we can add more objectclasses
|
||||||
$('#new_objectclass-modal').on('shown.bs.modal',function() {
|
$('#new_objectclass-modal').on('shown.bs.modal',function() {
|
||||||
|
if (! rendered)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
// @todo When this is opened a second time, the data is appended.
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('select#newoc').select2({
|
$('select#newoc').select2({
|
||||||
dropdownParent: $('#new_objectclass-modal'),
|
dropdownParent: $('#new_objectclass-modal'),
|
||||||
@ -60,6 +63,8 @@
|
|||||||
url: '{{ url('entry/objectclass/add') }}/'+dn,
|
url: '{{ url('entry/objectclass/add') }}/'+dn,
|
||||||
cache: false
|
cache: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rendered = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
// When the ObjectClass modal is closed, process what was selected
|
// When the ObjectClass modal is closed, process what was selected
|
||||||
@ -85,7 +90,7 @@
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
beforeSend: function() {},
|
beforeSend: function() {},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#{{ $o->name_lc }}').append(data);
|
$('#{{ $o->name }}').append(data);
|
||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
if (e.status != 412)
|
if (e.status != 412)
|
||||||
@ -134,7 +139,7 @@
|
|||||||
if (data.may.length) {
|
if (data.may.length) {
|
||||||
var newattr = $('select#newattr');
|
var newattr = $('select#newattr');
|
||||||
|
|
||||||
// @todo It might be nice to resort this options
|
// @todo It might be nice to re-sort these options
|
||||||
data.may.forEach(function(item) {
|
data.may.forEach(function(item) {
|
||||||
newattr.append(new Option(item,item,false,false));
|
newattr.append(new Option(item,item,false,false));
|
||||||
});
|
});
|
||||||
@ -155,10 +160,45 @@
|
|||||||
if (newadded.indexOf(item) === -1) {
|
if (newadded.indexOf(item) === -1) {
|
||||||
$('span#objectclass_'+item).empty();
|
$('span#objectclass_'+item).empty();
|
||||||
|
|
||||||
// @todo remove any required attributes that are no longer defined as a result of removing this OC
|
|
||||||
console.log('Remove required attributes of:'+item);
|
|
||||||
// @todo Remove attributes from "Add new Attribute" that are no longer available
|
// @todo Remove attributes from "Add new Attribute" that are no longer available
|
||||||
console.log('Remove additional attributes of:'+item);
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
beforeSend: function() {},
|
||||||
|
success: function(data) {
|
||||||
|
var attrs = [];
|
||||||
|
|
||||||
|
// Remove attributes from "Add new Attribute" that are no longer available
|
||||||
|
if (data.may.length) {
|
||||||
|
data.may.forEach(function(mayitem) {
|
||||||
|
var x = $("select#newattr option[value='"+mayitem+"']");
|
||||||
|
|
||||||
|
if (x.length) {
|
||||||
|
x.remove();
|
||||||
|
|
||||||
|
// Add this to the must attrs list, because its been rendered
|
||||||
|
} else {
|
||||||
|
attrs.push(mayitem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
data.must.concat(attrs).forEach(function(attr) {
|
||||||
|
var x = $('#'+attr).find('input');
|
||||||
|
|
||||||
|
x.css('background-color','#f0c0c0').attr('readonly',true).attr('placeholder',x.val()).val('');
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove the Add Values box
|
||||||
|
// Remove any keyed in values
|
||||||
|
// @todo remove any required attributes that are no longer defined as a result of removing this OC
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
if (e.status != 412)
|
||||||
|
alert('That didnt work? Please try again....');
|
||||||
|
},
|
||||||
|
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
|
||||||
|
cache: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,17 +212,17 @@
|
|||||||
@case('App\Classes\LDAP\Attribute')
|
@case('App\Classes\LDAP\Attribute')
|
||||||
@default
|
@default
|
||||||
@php($clone=TRUE)
|
@php($clone=TRUE)
|
||||||
<span @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) id="{{ $o->name_lc }}"><i class="fas fa-fw fa-plus"></i> @lang('Add Value')</span>
|
<span @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) id="{{ $o->name }}-addnew"><i class="fas fa-fw fa-plus"></i> @lang('Add Value')</span>
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
@if($clone && $edit && $o->can_addvalues)
|
@if($clone && $edit && $o->can_addvalues)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Create a new entry when Add Value clicked
|
// Create a new entry when Add Value clicked
|
||||||
$('#{{ $o->name_lc }}.addable').click(function (item) {
|
$('#{{ $o->name }}-addnew.addable').click(function (item) {
|
||||||
var cln = $(this).parent().parent().find('input:last').parent().clone();
|
var cln = $(this).parent().parent().find('input:last').parent().clone();
|
||||||
cln.find('input:last').attr('value','').attr('placeholder', '[@lang('NEW')]');
|
cln.find('input:last').attr('value','').attr('placeholder', '[@lang('NEW')]');
|
||||||
cln.appendTo('#' + item.currentTarget.id)
|
cln.appendTo('#'+item.currentTarget.id.replace('-addnew',''));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user