Minor schema cosmetic code fixes, more Attribute implementation from old pla, start of LDAP DN view/edit

This commit is contained in:
2023-03-02 09:54:30 +11:00
parent 491f04cd5d
commit 64d1a09db4
15 changed files with 234 additions and 99 deletions

View File

@@ -20,6 +20,12 @@ class Attribute
// Current and Old Values
protected Collection $values;
// Can this attribute be deleted
protected bool $deletable = FALSE;
// Is this attribute an internal attribute
protected bool $internal;
/*
protected $oldvalues = array();
@@ -27,8 +33,6 @@ class Attribute
protected $min_value_count = -1;
protected $max_value_count = -1;
# Is the attribute internal
protected $internal = false;
# Has the attribute been modified
protected $modified = false;
# Is the attribute being deleted because of an object class removal
@@ -100,6 +104,20 @@ class Attribute
*/
}
public function __get(string $key): mixed
{
switch ($key) {
case 'name':
return $this->{$key};
case 'internal': return isset($this->{$key}) && $this->{$key};
case 'name_lc': return strtolower($this->name);
default:
throw new \Exception('Unknown key:'.$key);
}
}
/**
* Determine how we render this attribute's value
*
@@ -903,4 +921,18 @@ class Attribute
debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1);
}
*/
/**
* 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;
$clone->deletable = TRUE;
return $clone;
}
}