From 6b2fb8dee4f439c4c2eee054b82a6e03374b5ea6 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 8 Apr 2025 11:04:31 +1000 Subject: [PATCH] Dont add hints for internal attributes. Our hints now also returns a collection. --- app/Classes/LDAP/Attribute.php | 9 ++++++--- app/Classes/LDAP/Attribute/RDN.php | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Classes/LDAP/Attribute.php b/app/Classes/LDAP/Attribute.php index e717f7f4..85c3d56d 100644 --- a/app/Classes/LDAP/Attribute.php +++ b/app/Classes/LDAP/Attribute.php @@ -226,12 +226,15 @@ class Attribute implements \Countable, \ArrayAccess /** * Return the hints about this attribute, ie: RDN, Required, etc * - * @return array + * @return Collection */ - public function hints(): array + public function hints(): Collection { $result = collect(); + if ($this->is_internal) + return $result; + // Is this Attribute an RDN if ($this->is_rdn) $result->put(__('rdn'),__('This attribute is required for the RDN')); @@ -246,7 +249,7 @@ class Attribute implements \Countable, \ArrayAccess if ($this->isDynamic()) $result->put(__('dynamic'),__('These are dynamic values present as a result of another attribute')); - return $result->toArray(); + return $result; } /** diff --git a/app/Classes/LDAP/Attribute/RDN.php b/app/Classes/LDAP/Attribute/RDN.php index 48c99575..ea26007f 100644 --- a/app/Classes/LDAP/Attribute/RDN.php +++ b/app/Classes/LDAP/Attribute/RDN.php @@ -24,11 +24,11 @@ final class RDN extends Attribute }; } - public function hints(): array + public function hints(): Collection { - return [ + return collect([ 'required' => __('RDN is required') - ]; + ]); } public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View