Start of enabling DN update.

This commit is contained in:
2023-03-31 15:55:08 +11:00
parent a1a9b8ba76
commit c36383b0fc
13 changed files with 359 additions and 125 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Classes\LDAP;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use App\Classes\LDAP\Schema\AttributeType;
@@ -130,12 +131,14 @@ class Attribute
'hints' => $this->hints(),
// Is this an internal attribute
'is_internal' => isset($this->{$key}) && $this->{$key},
// Is this attribute the RDN
'is_rdn' => $this->is_rdn,
// We prefer the name as per the schema if it exists
'name' => $this->schema ? $this->schema->{$key} : $this->{$key},
// Attribute name in lower case
'name_lc' => strtolower($this->name),
// Is this attribute the RDN
'rdn' => $this->is_rdn,
// Attribute values
'values' => $this->values,
default => throw new \Exception('Unknown key:' . $key),
};
@@ -151,22 +154,6 @@ class Attribute
return $this->values->join('<br>');
}
/**
* Return an instance of this attribute that is deletable.
* This is primarily used for rendering to know if to render delete options.
*
* @return Attribute
*/
public function deletable(): self
{
$clone = clone $this;
if (! $this->required_by->count())
$clone->is_deletable = TRUE;
return $clone;
}
/**
* Return the hints about this attribute, ie: RDN, Required, etc
*
@@ -195,6 +182,13 @@ class Attribute
return $result->toArray();
}
public function render(bool $edit): View
{
return view('components.attribute')
->with('edit',$edit)
->with('o',$this);
}
/**
* Set the objectclasses that require this attribute
*