diff --git a/app/Classes/LDAP/Attribute.php b/app/Classes/LDAP/Attribute.php index a6b7133..736401f 100644 --- a/app/Classes/LDAP/Attribute.php +++ b/app/Classes/LDAP/Attribute.php @@ -3,6 +3,7 @@ namespace App\Classes\LDAP; use Illuminate\Contracts\View\View; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; use App\Classes\LDAP\Schema\AttributeType; @@ -259,6 +260,16 @@ class Attribute implements \Countable, \ArrayAccess ->with('new',$new); } + public function render_item_old(int $key): ?string + { + return Arr::get($this->old_values,$key); + } + + public function render_item_new(int $key): ?string + { + return Arr::get($this->values,$key); + } + /** * Set the objectclasses that require this attribute * diff --git a/app/Classes/LDAP/Attribute/Password.php b/app/Classes/LDAP/Attribute/Password.php index ba182bd..33c1719 100644 --- a/app/Classes/LDAP/Attribute/Password.php +++ b/app/Classes/LDAP/Attribute/Password.php @@ -3,6 +3,7 @@ namespace App\Classes\LDAP\Attribute; use Illuminate\Contracts\View\View; +use Illuminate\Support\Arr; use App\Classes\LDAP\Attribute; use App\Traits\MD5Updates; @@ -22,4 +23,14 @@ final class Password extends Attribute ->with('old',$old) ->with('new',$new); } + + public function render_item_old(int $key): ?string + { + return Arr::get($this->oldValues,$key) ? str_repeat('x',8) : NULL; + } + + public function render_item_new(int $key): ?string + { + return Arr::get($this->values,$key) ? str_repeat('x',8) : NULL; + } } \ No newline at end of file diff --git a/app/Ldap/Entry.php b/app/Ldap/Entry.php index b0b6705..1b34fae 100644 --- a/app/Ldap/Entry.php +++ b/app/Ldap/Entry.php @@ -32,7 +32,7 @@ class Entry extends Model parent::discardChanges(); // If we are discharging changes, we need to reset our $objects; - $this->objects = $this->getAttributesAsObjects($this->attributes); + $this->objects = $this->getAttributesAsObjects(); return $this; } @@ -112,7 +112,7 @@ class Entry extends Model // We only set our objects on DN entries (otherwise we might get into a recursion loop if this is the schema DN) if ($this->dn && (! in_array($this->dn,Arr::get($this->attributes,'subschemasubentry',[])))) { - $this->objects = $this->getAttributesAsObjects($this->attributes); + $this->objects = $this->getAttributesAsObjects(); } else { $this->objects = collect(); @@ -157,11 +157,11 @@ class Entry extends Model * @param array $attributes * @return Collection */ - protected function getAttributesAsObjects(array $attributes): Collection + public function getAttributesAsObjects(): Collection { $result = collect(); - foreach ($attributes as $attribute => $value) { + foreach ($this->attributes as $attribute => $value) { // If the attribute name has language tags $matches = []; if (preg_match('/^([a-zA-Z]+)(;([a-zA-Z-;]+))+/',$attribute,$matches)) { @@ -271,7 +271,7 @@ class Entry extends Model { // In case we havent built our objects yet (because they werent available while determining the schema DN) if ((! $this->objects->count()) && $this->attributes) - $this->objects = $this->getAttributesAsObjects($this->attributes); + $this->objects = $this->getAttributesAsObjects(); return $this->objects; } diff --git a/resources/views/components/attribute/password.blade.php b/resources/views/components/attribute/password.blade.php index 048738e..5f29f84 100644 --- a/resources/views/components/attribute/password.blade.php +++ b/resources/views/components/attribute/password.blade.php @@ -1,8 +1,8 @@ - @foreach ($o->values as $value) - @if ($edit) + @foreach($o->values as $value) + @if($edit)
($e=$errors->get($o->name_lc.'.'.$loop->index)),'mb-1','border-focus'=>$o->values->contains($value)]) name="{{ $o->name_lc }}[]" value="{{ md5($value) }}" @readonly(true)> @@ -13,11 +13,13 @@
@else - {{ $value }}
+ {{ str_repeat('x',8) }} @endif @endforeach - - @lang('Check Password') - + @if($edit) + + @lang('Check Password') + + @endif
\ No newline at end of file diff --git a/resources/views/update.blade.php b/resources/views/update.blade.php index 8da1ddc..78701fe 100644 --- a/resources/views/update.blade.php +++ b/resources/views/update.blade.php @@ -16,10 +16,10 @@
-
+

@lang('Do you want to make the following changes?')

- +
@@ -29,16 +29,18 @@ - @foreach ($o->getDirty() as $key => $value) + @foreach ($o->getAttributesAsObjects()->filter(fn($item)=>$item->isDirty()) as $key => $oo) - + @for($xx=0;$xx<$x;$xx++) @if($xx) @endif - - + + @endfor @endforeach
Attribute
{{ $key }} + {{ $oo->name }} +
{{ Arr::get(Arr::get($o->getOriginal(),$key),$xx,'['.strtoupper(__('New Value')).']') }}{{ ($y=Arr::get($value,$xx)) ?: '['.strtoupper(__('Deleted')).']' }}{{ $oo->render_item_old($xx) ?: '['.strtoupper(__('New Value')).']' }}{{ $oo->render_item_new($xx) ?: '['.strtoupper(__('Deleted')).']' }}