diff --git a/app/Classes/LDAP/Attribute.php b/app/Classes/LDAP/Attribute.php
index 1fcc33ee..666fe43c 100644
--- a/app/Classes/LDAP/Attribute.php
+++ b/app/Classes/LDAP/Attribute.php
@@ -36,7 +36,7 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
// The old values for this attribute - helps with isDirty() to determine if there is an update pending
protected(set) Collection $values_old;
// Current Values
- public Collection $values;
+ protected Collection $values;
// The objectclasses of the entry that has this attribute
protected(set) Collection $oc;
@@ -152,11 +152,26 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
'required_by' => $this->schema?->required_by_object_classes ?: collect(),
// Used in Object Classes
'used_in' => $this->schema?->used_in_object_classes ?: collect(),
+ // The current attribute values
+ 'values' => $this->values,
default => throw new \Exception('Unknown key:' . $key),
};
}
+ public function __set(string $key,mixed $values)
+ {
+ switch ($key) {
+ case 'values':
+ if (is_null($values)) throw new \Exception('values is null?');
+ $this->values = $values;
+ break;
+
+ default:
+ throw new \Exception('Unknown key:'.$key);
+ }
+ }
+
public function __toString(): string
{
return $this->name;
diff --git a/app/Classes/LDAP/Attribute/Factory.php b/app/Classes/LDAP/Attribute/Factory.php
index e11ee1f8..f4841a15 100644
--- a/app/Classes/LDAP/Attribute/Factory.php
+++ b/app/Classes/LDAP/Attribute/Factory.php
@@ -22,6 +22,7 @@ class Factory
public const map = [
'createtimestamp' => Internal\Timestamp::class,
'creatorsname' => Internal\DN::class,
+ 'configcontext' => Schema\Generic::class,
'contextcsn' => Internal\CSN::class,
'entrycsn' => Internal\CSN::class,
'entrydn' => Internal\DN::class,
@@ -34,6 +35,8 @@ class Factory
'jpegphoto' => Binary\JpegPhoto::class,
'modifytimestamp' => Internal\Timestamp::class,
'modifiersname' => Internal\DN::class,
+ 'monitorcontext' => Schema\Generic::class,
+ 'namingcontexts' => Schema\Generic::class,
'numsubordinates' => Internal\NumSubordinates::class,
'objectclass' => ObjectClass::class,
'pwdpolicysubentry' => Internal\PwdPolicySubentry::class,
@@ -42,6 +45,7 @@ class Factory
'supportedcontrol' => Schema\OID::class,
'supportedextension' => Schema\OID::class,
'supportedfeatures' => Schema\OID::class,
+ 'supportedldapversion' => Schema\Generic::class,
'supportedsaslmechanisms' => Schema\Mechanisms::class,
'userpassword' => Password::class,
];
diff --git a/app/Classes/LDAP/Attribute/Internal.php b/app/Classes/LDAP/Attribute/Internal.php
index bdfddcf5..6db070d5 100644
--- a/app/Classes/LDAP/Attribute/Internal.php
+++ b/app/Classes/LDAP/Attribute/Internal.php
@@ -13,6 +13,15 @@ abstract class Internal extends Attribute
{
protected(set) bool $is_internal = TRUE;
+ public function __get(string $key): mixed
+ {
+ return match ($key) {
+ // Internal items shouldnt have language tags, so our values should only have 1 key
+ 'values'=>collect($this->values->first()),
+ default => parent::__get($key),
+ };
+ }
+
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
{
// @note Internal attributes cannot be edited
diff --git a/app/Classes/LDAP/Attribute/Schema.php b/app/Classes/LDAP/Attribute/Schema.php
index ef5699c6..c1f7f48a 100644
--- a/app/Classes/LDAP/Attribute/Schema.php
+++ b/app/Classes/LDAP/Attribute/Schema.php
@@ -30,7 +30,7 @@ abstract class Schema extends Attribute
while (! feof($f)) {
$line = trim(fgets($f));
- if (! $line OR preg_match('/^#/',$line))
+ if ((! $line) || preg_match('/^#/',$line))
continue;
$fields = explode(':',$line);
@@ -41,12 +41,24 @@ abstract class Schema extends Attribute
'desc'=>Arr::get($fields,3,__('No description available, can you help with one?')),
]);
}
+
fclose($f);
return $result;
});
- return Arr::get(($array ? $array->get($string) : []),$key);
+ return Arr::get(($array ? $array->get($string) : []),
+ $key,
+ __('No description available, can you help with one?'));
+ }
+
+ public function __get(string $key): mixed
+ {
+ return match ($key) {
+ // Schema items shouldnt have language tags, so our values should only have 1 key
+ 'values'=>collect($this->values->first()),
+ default => parent::__get($key),
+ };
}
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
diff --git a/app/Classes/LDAP/Attribute/Schema/Generic.php b/app/Classes/LDAP/Attribute/Schema/Generic.php
new file mode 100644
index 00000000..dbc92338
--- /dev/null
+++ b/app/Classes/LDAP/Attribute/Schema/Generic.php
@@ -0,0 +1,20 @@
+with('o',$this);
+ }
+}
\ No newline at end of file
diff --git a/resources/views/components/attribute/internal.blade.php b/resources/views/components/attribute/internal.blade.php
index 1887ed44..094044e4 100644
--- a/resources/views/components/attribute/internal.blade.php
+++ b/resources/views/components/attribute/internal.blade.php
@@ -1,5 +1,5 @@
-@foreach (old($o->name_lc,$o->values) as $value)
+@foreach(old($o->name_lc,$o->values) as $value)
@if($loop->index)
@endif
{{ $value }}
@endforeach
\ No newline at end of file
diff --git a/resources/views/components/attribute/internal/timestamp.blade.php b/resources/views/components/attribute/internal/timestamp.blade.php
index e4278a45..f4c034b5 100644
--- a/resources/views/components/attribute/internal/timestamp.blade.php
+++ b/resources/views/components/attribute/internal/timestamp.blade.php
@@ -1,5 +1,5 @@
-@foreach (old($o->name_lc,$o->values) as $value)
+@foreach(old($o->name_lc,$o->values) as $value)
@if($loop->index)
@endif
{{ \Carbon\Carbon::createFromTimestamp(strtotime($value))->format(config('pla.datetime_format','Y-m-d H:i:s')) }}
@endforeach
\ No newline at end of file
diff --git a/resources/views/components/attribute/schema/generic.blade.php b/resources/views/components/attribute/schema/generic.blade.php
new file mode 100644
index 00000000..eb7a2911
--- /dev/null
+++ b/resources/views/components/attribute/schema/generic.blade.php
@@ -0,0 +1 @@
+{!! $o->values->join('
') !!}
\ No newline at end of file