Ported the schema browser
This commit is contained in:
78
resources/views/frames/schema.blade.php
Normal file
78
resources/views/frames/schema.blade.php
Normal file
@@ -0,0 +1,78 @@
|
||||
@extends('layouts.dn')
|
||||
|
||||
@section('page_title')
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td style="border-radius: 5px;"><div class="page-title-icon f32"><i class="fas fa-fingerprint"></i></div></td>
|
||||
<td class="top text-right align-text-top p-0 pt-2"><strong>{{ \App\Ldap\Entry::schemaDN() }}</strong><br><small>{{ $o->entryuuid[0] ?? '' }}</small></td>
|
||||
</tr>
|
||||
</table>
|
||||
@endsection
|
||||
|
||||
@section('main-content')
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body"><h5 class="card-title">{{ __('Schema Information') }}</h5>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item"><a data-toggle="tab" href="#objectclasses" class="nav-link">{{ __('Object Classes') }}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" href="#attributetypes" class="nav-link">{{ __('Attribute Types') }}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" href="#ldapsyntaxes" class="nav-link">{{ __('Syntaxes') }}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" href="#matchingrules" class="nav-link">{{ __('Matching Rules') }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<!-- Object Classes -->
|
||||
<div class="tab-pane" id="objectclasses" role="tabpanel">
|
||||
<div id="schema.objectclasses"><i class="fas fa-fw fa-spinner fa-pulse"></i></div>
|
||||
</div>
|
||||
|
||||
<!-- Attribute Types -->
|
||||
<div class="tab-pane" id="attributetypes" role="tabpanel">
|
||||
<div id="schema.attributetypes"><i class="fas fa-fw fa-spinner fa-pulse"></i></div>
|
||||
</div>
|
||||
|
||||
<!-- Syntaxes -->
|
||||
<div class="tab-pane" id="ldapsyntaxes" role="tabpanel">
|
||||
<div id="schema.ldapsyntaxes"><i class="fas fa-fw fa-spinner fa-pulse"></i></div>
|
||||
</div>
|
||||
|
||||
<!-- Matching Rules -->
|
||||
<div class="tab-pane" id="matchingrules" role="tabpanel">
|
||||
<div id="schema.matchingrules"><i class="fas fa-fw fa-spinner fa-pulse"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
var loaded = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (item) {
|
||||
// activated tab
|
||||
var type = $(item.target).attr('href').substring(1);
|
||||
if (loaded[type])
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url('api/schema/view') }}',
|
||||
method: 'POST',
|
||||
data: { type: type },
|
||||
dataType: 'html',
|
||||
|
||||
}).done(function(html) {
|
||||
$('div[id="schema.'+type+'"]').empty().append(html);
|
||||
loaded[type] = true;
|
||||
|
||||
}).fail(function() {
|
||||
alert('Failed');
|
||||
});
|
||||
|
||||
item.stopPropagation();
|
||||
});
|
||||
|
||||
// Open our objectclasses tab automatically
|
||||
$('.nav-item a[href="#objectclasses"]').tab('show');
|
||||
});
|
||||
</script>
|
||||
@append
|
153
resources/views/frames/schema/attributetypes.blade.php
Normal file
153
resources/views/frames/schema/attributetypes.blade.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12 col-xl-3">
|
||||
<select id="attributetype" class="form-control">
|
||||
<option value="-all-">-all-</option>
|
||||
@foreach ($attributetypes as $o)
|
||||
<option value="{{ $o->name_lc }}">{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-xl-9">
|
||||
@foreach ($attributetypes as $o)
|
||||
<span id="at-{{ $o->name_lc }}">
|
||||
<table class="schema table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-dark" colspan="2">{{ $o->name }}<span class="float-right"><abbr title="{{ $o->line }}"><i class="fas fa-fw fa-file-contract"></i></abbr></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="w-25">{{ __('Description') }}</td><td><strong>{{ __($o->description ?: '(no description)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><abbr title="{{ __('Object Identifier') }}">OID</abbr></td><td><strong>{{ $o->oid }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Obsolete') }}</td><td><strong>{{ $o->is_obsolete ? __('Yes') : __('No') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Inherits from') }}</td>
|
||||
<td><strong>@if ($o->sup_attribute)<a class="attributetype" id="{{ strtolower($o->sup_attribute) }}" href="#{{ strtolower($o->sup_attribute) }}">{{ $o->sup_attribute }}</a>@else {{ __('(none)') }}@endif</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Parent to') }}</td>
|
||||
<td>
|
||||
<strong>
|
||||
@if (! $o->children->count())
|
||||
{{ __('(none)') }}
|
||||
@else
|
||||
@foreach ($o->children->sort() as $child)
|
||||
@if($loop->index)</strong> <strong>@endif
|
||||
<a class="attributetype" id="{{ strtolower($child) }}" href="#{{ strtolower($child) }}">{{ $child }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Equality') }}</td><td><strong>{{ $o->equality ?: __('(not specified)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Ordering') }}</td><td><strong>{{ $o->ordering ?: __('(not specified)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Substring Rule') }}</td><td><strong>{{ $o->sub_str_rule ?: __('(not specified)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Syntax') }}</td><td><strong>{{ ($o->syntax_oid && $x=$server->schemaSyntaxName($o->syntax_oid)) ? $x->description : __('(unknown syntax)') }} @if($o->syntax_oid)({{ $o->syntax_oid }})@endif</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Single Valued') }}</td><td><strong>{{ $o->is_single_value ? __('Yes') : __('No') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Collective') }}</td><td><strong>{{ $o->is_collective ? __('Yes') : __('No') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('User Modification') }}</td><td><strong>{{ $o->is_no_user_modification ? __('Yes') : __('No') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Usage') }}</td><td><strong>{{ $o->usage ?: __('(not specified)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Maximum Length') }}</td><td><strong>{{ is_null($o->max_length) ? __('(not applicable)') : sprintf('%s %s',number_format($o->max_length),Str::plural('character',$o->max_length)) }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Aliases') }}</td>
|
||||
<td><strong>
|
||||
@if ($o->aliases->count())
|
||||
@foreach ($o->aliases as $alias)
|
||||
@if ($loop->index)</strong> <strong>@endif
|
||||
<a class="attributetype" id="{{ strtolower($alias) }}" href="#{{ strtolower($alias) }}">{{ $alias }}</a>
|
||||
@endforeach
|
||||
@else
|
||||
{{ __('(none)') }}
|
||||
@endif
|
||||
</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Used by ObjectClasses') }}</td>
|
||||
<td><strong>
|
||||
@if ($o->used_in_object_classes->count())
|
||||
@foreach ($o->used_in_object_classes as $class)
|
||||
@if ($loop->index)</strong> <strong>@endif
|
||||
<a class="objectclass" id="{{ strtolower($class) }}" href="#{{ strtolower($class) }}">{{ $class }}</a>
|
||||
@endforeach
|
||||
@else
|
||||
{{ __('(none)') }}
|
||||
@endif
|
||||
</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Force as MAY by config') }}</td><td><strong>{{ $o->forced_as_may ? __('Yes') : __('No') }}</strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
<!-- Links to object class -->
|
||||
$('.objectclass')
|
||||
.on('click',function(item) {
|
||||
$('.nav-item a[href="#objectclasses"]').tab('show');
|
||||
|
||||
$('#objectclass').val(item.target.id).trigger('change');
|
||||
});
|
||||
|
||||
<!-- Handle our parent to/inherits from fields -->
|
||||
$('.attributetype')
|
||||
.on('click',function(item) {
|
||||
$('.nav-item a[href="#attributetypes"]').tab('show');
|
||||
$('#attributetype').val(item.target.id).trigger('change');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
<!-- Handle our select list -->
|
||||
$('#attributetype')
|
||||
.select2({width: '100%'})
|
||||
.on('change',function(item) {
|
||||
if (item.target.value === '-all-') {
|
||||
$('#attributetypes span').each(function() { $(this).show(); });
|
||||
|
||||
} else {
|
||||
$('#attributetypes span').each(function() {
|
||||
if ($(this)[0].id.match(/select2/) || (! $(this)[0].id))
|
||||
return;
|
||||
|
||||
if ('at-'+item.target.value === $(this)[0].id)
|
||||
$(this).show();
|
||||
else
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
29
resources/views/frames/schema/ldapsyntaxes.blade.php
Normal file
29
resources/views/frames/schema/ldapsyntaxes.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="row">
|
||||
<div class="col-5 m-auto">
|
||||
<table class="schema table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-dark">{{ __('Description') }}</th>
|
||||
<th class="table-dark">OID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($ldapsyntaxes as $o)
|
||||
<tr>
|
||||
<td>
|
||||
<abbr title="{{ $o->line }}">{{ $o->description }}</abbr>
|
||||
@if ($o->binary_transfer_required)
|
||||
<span class="float-right"><i class="fas fa-fw fa-file-download"></i></span>
|
||||
@endif
|
||||
@if ($o->is_not_human_readable)
|
||||
<span class="float-right"><i class="fas fa-fw fa-tools"></i></span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $o->oid }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
101
resources/views/frames/schema/matchingrules.blade.php
Normal file
101
resources/views/frames/schema/matchingrules.blade.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-xl-3">
|
||||
<select id="matchingrule" class="form-control">
|
||||
<option value="-all-">-all-</option>
|
||||
@foreach ($matchingrules as $o)
|
||||
<option value="{{ $o->name_lc }}">{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-xl-9">
|
||||
@foreach ($matchingrules as $o)
|
||||
<span id="mr-{{ $o->name_lc }}">
|
||||
<table class="schema table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-dark" colspan="2">{{ $o->name }}<span class="float-right"><abbr title="{{ $o->line }}"><i class="fas fa-fw fa-file-contract"></i></abbr></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="w-25">{{ __('Description') }}</td><td><strong>{{ __($o->description ?: '(no description)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-25"><abbr title="{{ __('Object Identifier') }}">OID</abbr></td><td><strong>{{ $o->oid }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-25">{{ __('Syntax') }}</td><td><strong>{{ $o->syntax }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Used by Attributes') }}</td>
|
||||
<td>
|
||||
<strong>
|
||||
@if ($o->used_by_attrs->count() === 0)
|
||||
{{ __('(none)') }}
|
||||
@else
|
||||
@foreach ($o->used_by_attrs as $attr)
|
||||
@if($loop->index)</strong> <strong>@endif
|
||||
<a class="attributetype" id="{{ strtolower($attr) }}" href="#at-{{ strtolower($attr) }}">{{ $attr }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function hl_attribute(item,count) {
|
||||
if ((count < 50) && (! loaded['attributetypes'])) {
|
||||
setTimeout(hl_attribute,250,item,++count);
|
||||
} else if (count >= 50) {
|
||||
return false;
|
||||
} else {
|
||||
$('#attributetype').val(item.target.id).trigger('change');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.attributetype')
|
||||
.on('click',function(item) {
|
||||
$('.nav-item a[href="#attributetypes"]').tab('show');
|
||||
|
||||
return hl_attribute(item,0);
|
||||
});
|
||||
|
||||
<!-- Handle our parent to/inherits from fields -->
|
||||
$('.matchingrule')
|
||||
.on('click',function(item) {
|
||||
$('#matchingrule').val(item.target.id).trigger('change');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
<!-- Handle our select list -->
|
||||
$('#matchingrule')
|
||||
.select2({width: '100%'})
|
||||
.on('change',function(item) {
|
||||
if (item.target.value === '-all-') {
|
||||
$('#matchingrules span').each(function() { $(this).show(); });
|
||||
|
||||
} else {
|
||||
$('#matchingrules span').each(function() {
|
||||
if ($(this)[0].id.match(/select2/) || (! $(this)[0].id))
|
||||
return;
|
||||
|
||||
if ('mr-'+item.target.value === $(this)[0].id)
|
||||
$(this).show();
|
||||
else
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
147
resources/views/frames/schema/objectclasses.blade.php
Normal file
147
resources/views/frames/schema/objectclasses.blade.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-xl-3">
|
||||
<select id="objectclass" class="form-control">
|
||||
<option value="-all-">-all-</option>
|
||||
@foreach ($objectclasses as $o)
|
||||
<option value="{{ $o->name_lc }}">{{ $o->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-xl-9">
|
||||
@foreach ($objectclasses as $o)
|
||||
<span id="oc-{{ $o->name_lc }}">
|
||||
<table class="schema table table-sm table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-dark" colspan="4">{{ $o->name }}<span class="float-right"><abbr title="{{ $o->line }}"><i class="fas fa-fw fa-file-contract"></i></abbr></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="w-25">{{ __('Description') }}</td><td colspan="3"><strong>{{ __($o->description ?: '(no description)') }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="w-25"><abbr title="{{ __('Object Identifier') }}">OID</abbr></td><td colspan="3"><strong>{{ $o->oid }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Type') }}</td><td colspan="3"><strong>{{ __($o->type_name) }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Inherits from') }}</td>
|
||||
<td colspan="3">
|
||||
<strong>
|
||||
@if ($o->sup->count() === 0)
|
||||
{{ __('(none)') }}
|
||||
@else
|
||||
@foreach ($o->sup as $sup)
|
||||
@if($loop->index)</strong> <strong>@endif
|
||||
<a class="objectclass" id="{{ strtolower($sup) }}" href="#{{ strtolower($sup) }}">{{ $sup }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{{ __('Parent to') }}</td>
|
||||
<td colspan="3">
|
||||
<strong>
|
||||
@if (strtolower($o->name) === 'top')
|
||||
<a class="objectclass" id="-all-">(all)</a>
|
||||
@elseif (! $o->getChildObjectClasses()->count())
|
||||
{{ __('(none)') }}
|
||||
@else
|
||||
@foreach ($o->getChildObjectClasses() as $childoc)
|
||||
@if($loop->index)</strong> <strong>@endif
|
||||
<a class="objectclass" id="{{ strtolower($childoc) }}" href="#{{ strtolower($childoc) }}">{{ $childoc }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="align-top w-50" colspan="2">
|
||||
<table class="clearfix table table-sm table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-primary">{{ __('Required Attributes') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<ul class="pl-3" style="list-style-type: square;">
|
||||
@foreach ($o->getMustAttrs(TRUE) as $oo)
|
||||
<li>{{ $oo->name }} @if($oo->source !== $o->name)[<strong><a class="objectclass" id="{{ strtolower($oo->source) }}" href="#{{ strtolower($oo->source) }}">{{ $oo->source }}</a></strong>]@endif</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td class="align-top w-50" colspan="2">
|
||||
<table class="clearfix table table-sm table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-primary">{{ __('Optional Attributes') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<ul class="pl-3" style="list-style-type: square;">
|
||||
@foreach ($o->getMayAttrs(TRUE) as $oo)
|
||||
<li>{{ $oo->name }} @if($oo->source !== $o->name)[<strong><a class="objectclass" id="{{ strtolower($oo->source) }}" href="#{{ strtolower($oo->source) }}">{{ $oo->source }}</a></strong>]@endif</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
<!-- Handle our parent to/inherits from fields -->
|
||||
$('.objectclass')
|
||||
.on('click',function(item) {
|
||||
$('#objectclass').val(item.target.id).trigger('change');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
<!-- Handle our select list -->
|
||||
$('#objectclass')
|
||||
.select2({width: '100%'})
|
||||
.on('change',function(item) {
|
||||
if (item.target.value === '-all-') {
|
||||
$('#objectclasses span').each(function() { $(this).show(); });
|
||||
|
||||
} else {
|
||||
$('#objectclasses span').each(function() {
|
||||
if ($(this)[0].id.match(/select2/) || (! $(this)[0].id))
|
||||
return;
|
||||
|
||||
if ('oc-'+item.target.value === $(this)[0].id)
|
||||
$(this).show();
|
||||
else
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user