Internal attributes are now handled by the new backend setup for attribute tags
This commit is contained in:
parent
85c7132b30
commit
1470170928
@ -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
|
// The old values for this attribute - helps with isDirty() to determine if there is an update pending
|
||||||
protected(set) Collection $values_old;
|
protected(set) Collection $values_old;
|
||||||
// Current Values
|
// Current Values
|
||||||
public Collection $values;
|
protected Collection $values;
|
||||||
// The objectclasses of the entry that has this attribute
|
// The objectclasses of the entry that has this attribute
|
||||||
protected(set) Collection $oc;
|
protected(set) Collection $oc;
|
||||||
|
|
||||||
@ -152,11 +152,26 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
|
|||||||
'required_by' => $this->schema?->required_by_object_classes ?: collect(),
|
'required_by' => $this->schema?->required_by_object_classes ?: collect(),
|
||||||
// Used in Object Classes
|
// Used in Object Classes
|
||||||
'used_in' => $this->schema?->used_in_object_classes ?: collect(),
|
'used_in' => $this->schema?->used_in_object_classes ?: collect(),
|
||||||
|
// The current attribute values
|
||||||
|
'values' => $this->values,
|
||||||
|
|
||||||
default => throw new \Exception('Unknown key:' . $key),
|
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
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
|
@ -22,6 +22,7 @@ class Factory
|
|||||||
public const map = [
|
public const map = [
|
||||||
'createtimestamp' => Internal\Timestamp::class,
|
'createtimestamp' => Internal\Timestamp::class,
|
||||||
'creatorsname' => Internal\DN::class,
|
'creatorsname' => Internal\DN::class,
|
||||||
|
'configcontext' => Schema\Generic::class,
|
||||||
'contextcsn' => Internal\CSN::class,
|
'contextcsn' => Internal\CSN::class,
|
||||||
'entrycsn' => Internal\CSN::class,
|
'entrycsn' => Internal\CSN::class,
|
||||||
'entrydn' => Internal\DN::class,
|
'entrydn' => Internal\DN::class,
|
||||||
@ -34,6 +35,8 @@ class Factory
|
|||||||
'jpegphoto' => Binary\JpegPhoto::class,
|
'jpegphoto' => Binary\JpegPhoto::class,
|
||||||
'modifytimestamp' => Internal\Timestamp::class,
|
'modifytimestamp' => Internal\Timestamp::class,
|
||||||
'modifiersname' => Internal\DN::class,
|
'modifiersname' => Internal\DN::class,
|
||||||
|
'monitorcontext' => Schema\Generic::class,
|
||||||
|
'namingcontexts' => Schema\Generic::class,
|
||||||
'numsubordinates' => Internal\NumSubordinates::class,
|
'numsubordinates' => Internal\NumSubordinates::class,
|
||||||
'objectclass' => ObjectClass::class,
|
'objectclass' => ObjectClass::class,
|
||||||
'pwdpolicysubentry' => Internal\PwdPolicySubentry::class,
|
'pwdpolicysubentry' => Internal\PwdPolicySubentry::class,
|
||||||
@ -42,6 +45,7 @@ class Factory
|
|||||||
'supportedcontrol' => Schema\OID::class,
|
'supportedcontrol' => Schema\OID::class,
|
||||||
'supportedextension' => Schema\OID::class,
|
'supportedextension' => Schema\OID::class,
|
||||||
'supportedfeatures' => Schema\OID::class,
|
'supportedfeatures' => Schema\OID::class,
|
||||||
|
'supportedldapversion' => Schema\Generic::class,
|
||||||
'supportedsaslmechanisms' => Schema\Mechanisms::class,
|
'supportedsaslmechanisms' => Schema\Mechanisms::class,
|
||||||
'userpassword' => Password::class,
|
'userpassword' => Password::class,
|
||||||
];
|
];
|
||||||
|
@ -13,6 +13,15 @@ abstract class Internal extends Attribute
|
|||||||
{
|
{
|
||||||
protected(set) bool $is_internal = TRUE;
|
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
|
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
|
||||||
{
|
{
|
||||||
// @note Internal attributes cannot be edited
|
// @note Internal attributes cannot be edited
|
||||||
|
@ -30,7 +30,7 @@ abstract class Schema extends Attribute
|
|||||||
while (! feof($f)) {
|
while (! feof($f)) {
|
||||||
$line = trim(fgets($f));
|
$line = trim(fgets($f));
|
||||||
|
|
||||||
if (! $line OR preg_match('/^#/',$line))
|
if ((! $line) || preg_match('/^#/',$line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$fields = explode(':',$line);
|
$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?')),
|
'desc'=>Arr::get($fields,3,__('No description available, can you help with one?')),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($f);
|
fclose($f);
|
||||||
|
|
||||||
return $result;
|
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
|
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
|
||||||
|
20
app/Classes/LDAP/Attribute/Schema/Generic.php
Normal file
20
app/Classes/LDAP/Attribute/Schema/Generic.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Classes\LDAP\Attribute\Schema;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
|
||||||
|
use App\Classes\LDAP\Attribute\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Generic Schema Attribute
|
||||||
|
*/
|
||||||
|
class Generic extends Schema
|
||||||
|
{
|
||||||
|
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
|
||||||
|
{
|
||||||
|
// @note Schema attributes cannot be edited
|
||||||
|
return view('components.attribute.schema.generic')
|
||||||
|
->with('o',$this);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<!-- $o=Internal::class -->
|
<!-- $o=Internal::class -->
|
||||||
@foreach (old($o->name_lc,$o->values) as $value)
|
@foreach(old($o->name_lc,$o->values) as $value)
|
||||||
@if($loop->index)<br>@endif
|
@if($loop->index)<br>@endif
|
||||||
{{ $value }}
|
{{ $value }}
|
||||||
@endforeach
|
@endforeach
|
@ -1,5 +1,5 @@
|
|||||||
<!-- $o=Internal\Timestamp::class -->
|
<!-- $o=Internal\Timestamp::class -->
|
||||||
@foreach (old($o->name_lc,$o->values) as $value)
|
@foreach(old($o->name_lc,$o->values) as $value)
|
||||||
@if($loop->index)<br>@endif
|
@if($loop->index)<br>@endif
|
||||||
{{ \Carbon\Carbon::createFromTimestamp(strtotime($value))->format(config('pla.datetime_format','Y-m-d H:i:s')) }}
|
{{ \Carbon\Carbon::createFromTimestamp(strtotime($value))->format(config('pla.datetime_format','Y-m-d H:i:s')) }}
|
||||||
@endforeach
|
@endforeach
|
@ -0,0 +1 @@
|
|||||||
|
{!! $o->values->join('<br>') !!}
|
Loading…
x
Reference in New Issue
Block a user