Compare commits

..

1 Commits

Author SHA1 Message Date
7aa0657f88 Revert version to 2.0.2-dev
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 26s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m39s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m52s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
2025-03-09 14:08:45 +11:00
5 changed files with 56 additions and 68 deletions

View File

@ -94,10 +94,12 @@ class Entry extends Model
$key = $this->normalizeAttributeKey($key); $key = $this->normalizeAttributeKey($key);
if ((! $this->objects->get($key)) && $value) if ((! $this->objects->get($key)) && $value) {
$this->objects->put($key,Factory::create($key,[])); $this->objects->put($key,Factory::create($key,$value));
} elseif ($this->objects->get($key)) {
$this->objects->get($key)->value = $this->attributes[$key]; $this->objects->get($key)->value = $this->attributes[$key];
}
return $this; return $this;
} }
@ -162,6 +164,7 @@ class Entry extends Model
/** /**
* Convert all our attribute values into an array of Objects * Convert all our attribute values into an array of Objects
* *
* @param array $attributes
* @return Collection * @return Collection
*/ */
public function getAttributesAsObjects(): Collection public function getAttributesAsObjects(): Collection

View File

@ -1,5 +1,5 @@
/** ensure our userpassword has select is next to the password input */ /** ensure our userpassword has select is next to the password input */
attribute#userPassword .select2-container--bootstrap-5 .select2-selection { div#userPassword .select2-container--bootstrap-5 .select2-selection {
font-size: inherit; font-size: inherit;
width: 9em; width: 9em;
border: #444054 1px solid; border: #444054 1px solid;
@ -11,7 +11,7 @@ attribute#userPassword .select2-container--bootstrap-5 .select2-selection {
border-top-right-radius: unset; border-top-right-radius: unset;
} }
attribute#objectClass .input-group-end:not(input.form-control) { div#objectClass .input-group-end:not(input.form-control) {
position: absolute; position: absolute;
right: 1em; right: 1em;
top: 0.5em; top: 0.5em;

View File

@ -1,9 +1,9 @@
<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">
<attribute id="{{ $o->name }}"> <div id="{{ $o->name }}">
{{ $slot }} {{ $slot }}
</attribute> </div>
<x-attribute.widget.options :o="$o" :edit="$edit" :new="$new"/> <x-attribute.widget.options :o="$o" :edit="$edit" :new="$new"/>
</div> </div>

View File

@ -1,18 +1,15 @@
@use(App\Classes\LDAP\Attribute\Binary\JpegPhoto)
@use(App\Classes\LDAP\Attribute\ObjectClass)
@php($clone=FALSE) @php($clone=FALSE)
<span class="p-0 m-0"> @if($o->is_rdn)
@if($o->is_rdn)
<br/>
<button class="btn btn-sm btn-outline-focus mt-3" disabled><i class="fas fa-fw fa-exchange"></i> @lang('Rename')</button> <button class="btn btn-sm btn-outline-focus mt-3" disabled><i class="fas fa-fw fa-exchange"></i> @lang('Rename')</button>
@elseif($edit && $o->can_addvalues) @elseif($edit && $o->can_addvalues)
<span class="p-0 m-0">
@switch(get_class($o)) @switch(get_class($o))
@case(JpegPhoto::class) @case('App\Classes\LDAP\Attribute\Binary\JpegPhoto')
<button @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) id="{{ $o->name_lc }}" disabled><i class="fas fa-fw fa-plus"></i> @lang('Upload JpegPhoto')</button> <button @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) id="{{ $o->name_lc }}" disabled><i class="fas fa-fw fa-plus"></i> @lang('Upload JpegPhoto')</button>
@break @break
@case(ObjectClass::class) @case('App\Classes\LDAP\Attribute\ObjectClass')
<button type="button" @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) data-bs-toggle="modal" data-bs-target="#new_objectclass-modal"><i class="fas fa-fw fa-plus"></i> @lang('Add Objectclass')</button> <button type="button" @class(['btn','btn-sm','btn-outline-primary','mt-3','addable','d-none'=>(! $new)]) data-bs-toggle="modal" data-bs-target="#new_objectclass-modal"><i class="fas fa-fw fa-plus"></i> @lang('Add Objectclass')</button>
<!-- NEW OBJECT CLASS --> <!-- NEW OBJECT CLASS -->
@ -40,12 +37,42 @@
$(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; var rendered = false;
var newadded = [];
if (newadded.length) // Show our ObjectClass modal so that we can add more objectclasses
process_oc(); $('#new_objectclass-modal').on('shown.bs.modal',function() {
if (! rendered)
$.ajax({
method: 'POST',
url: '{{ url('entry/objectclass/add') }}',
data: {
oc: oc,
},
cache: false,
success: function(data) {
$('select#newoc').select2({
dropdownParent: $('#new_objectclass-modal'),
theme: 'bootstrap-5',
multiple: true,
data: data,
});
},
error: function(e) {
if (e.status !== 412)
alert('That didnt work? Please try again....');
},
});
rendered = true;
})
// When the ObjectClass modal is closed, process what was selected
$('#new_objectclass-modal').on('hide.bs.modal',function() {
var newadded = $('select#newoc').val();
// If nothing selected, we dont have anything to do
if (added_oc.sort().join('|') === newadded.sort().join('|'))
return;
function process_oc() {
// Find out what was selected, and add them // Find out what was selected, and add them
newadded.forEach(function (item) { newadded.forEach(function (item) {
if (added_oc.indexOf(item) !== -1) if (added_oc.indexOf(item) !== -1)
@ -70,7 +97,6 @@
}, },
}); });
// Get a list of attributes already on the page, so we dont double up
$.ajax({ $.ajax({
method: 'POST', method: 'POST',
url: '{{ url('api/schema/objectclass/attrs') }}/'+item, url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
@ -79,9 +105,6 @@
// Render any must attributes // Render any must attributes
if (data.must.length) { if (data.must.length) {
data.must.forEach(function(item) { data.must.forEach(function(item) {
if ($('attribute#'+item).length)
return;
// Add attribute to the page // Add attribute to the page
$.ajax({ $.ajax({
method: 'POST', method: 'POST',
@ -173,51 +196,13 @@
}); });
added_oc = newadded; added_oc = newadded;
}
// Show our ObjectClass modal so that we can add more objectclasses
$('#new_objectclass-modal').on('shown.bs.modal',function() {
if (! rendered)
$.ajax({
method: 'POST',
url: '{{ url('entry/objectclass/add') }}',
data: {
oc: oc,
},
cache: false,
success: function(data) {
$('select#newoc').select2({
dropdownParent: $('#new_objectclass-modal'),
theme: 'bootstrap-5',
multiple: true,
data: data,
});
},
error: function(e) {
if (e.status !== 412)
alert('That didnt work? Please try again....');
},
});
rendered = true;
})
// When the ObjectClass modal is closed, process what was selected
$('#new_objectclass-modal').on('hide.bs.modal',function() {
newadded = $('select#newoc').val();
// If nothing selected, we dont have anything to do
if (added_oc.sort().join('|') === newadded.sort().join('|'))
return;
process_oc();
}); });
}); });
</script> </script>
@append @append
@break @break
<!-- All other attributes --> @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 }}-addnew"><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>
@ -237,5 +222,5 @@
@endif @endif
@append @append
@endswitch @endswitch
@endif </span>
</span> @endif

View File

@ -13,7 +13,7 @@
<div class="row"> <div class="row">
<div class="col-12 pt-2"> <div class="col-12 pt-2">
<x-form.select id="newattr" label="Select from..." :options="$o->getMissingAttributes()->sortBy('name')->unique()->map(fn($item)=>['id'=>$item->name,'value'=>$item->name_lc])"/> <x-form.select id="newattr" label="Select from..." :options="$o->getMissingAttributes()->sortBy('name')->map(fn($item)=>['id'=>$item->name,'value'=>$item->name_lc])"/>
</div> </div>
</div> </div>
</div> </div>