Work on DN edit rendering

This commit is contained in:
2023-04-12 08:17:57 +10:00
parent 20a2fede08
commit f01f88b3bd
14 changed files with 147 additions and 61 deletions

View File

@@ -25,9 +25,6 @@ class Attribute
// Current and Old Values
protected Collection $values;
// Can this attribute be deleted
protected bool $is_deletable = FALSE;
// Is this attribute an internal attribute
protected bool $is_internal = FALSE;
@@ -129,6 +126,8 @@ class Attribute
'description' => $this->schema ? $this->schema->{$key} : NULL,
// Attribute hints
'hints' => $this->hints(),
// Can this attribute be edited
'is_editable' => $this->schema ? $this->schema->{$key} : NULL,
// Is this an internal attribute
'is_internal' => isset($this->{$key}) && $this->{$key},
// Is this attribute the RDN

View File

@@ -3,6 +3,7 @@
namespace App\Classes\LDAP\Attribute;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use App\Classes\LDAP\Attribute;
@@ -11,15 +12,33 @@ use App\Classes\LDAP\Attribute;
*/
final class ObjectClass extends Attribute
{
public function __get(string $key): mixed
// Which of the values is the structural object class
protected Collection $structural;
public function __construct(string $name,array $values)
{
switch ($key) {
case 'is_structural': return FALSE; // @todo - need to determine which of the values is the structural objectclass value(s)
default:
return parent::__get($key);
parent::__construct($name,$values);
$this->structural = collect();
// Determine which of the values is the structural objectclass
foreach ($values as $oc) {
if (config('server')->schema('objectclasses',$oc)->isStructural())
$this->structural->push($oc);
}
}
/**
* Is a specific value the structural objectclass
*
* @param string $value
* @return bool
*/
public function isStructural(string $value): bool
{
return $this->structural->search($value) !== FALSE;
}
public function render(bool $edit=FALSE): View
{
return view('components.attribute.objectclass')

View File

@@ -257,6 +257,7 @@ final class AttributeType extends Base {
case 'children': return $this->children;
case 'forced_as_may': return $this->forced_as_may;
case 'is_collective': return $this->is_collective;
case 'is_editable': return ! $this->is_no_user_modification;
case 'is_no_user_modification': return $this->is_no_user_modification;
case 'is_single_value': return $this->is_single_value;
case 'equality': return $this->equality;