Automatically work out if attributes are internal (because they are not used in objectclasses)
Some checks failed
Create Docker Image / Test Application (x86_64) (push) Has been cancelled
Create Docker Image / Build Docker Image (arm64) (push) Has been cancelled
Create Docker Image / Build Docker Image (x86_64) (push) Has been cancelled
Create Docker Image / Final Docker Image Manifest (push) Has been cancelled
Some checks failed
Create Docker Image / Test Application (x86_64) (push) Has been cancelled
Create Docker Image / Build Docker Image (arm64) (push) Has been cancelled
Create Docker Image / Build Docker Image (x86_64) (push) Has been cancelled
Create Docker Image / Final Docker Image Manifest (push) Has been cancelled
This commit is contained in:
parent
84f82aaf59
commit
ae782577e7
@ -18,7 +18,7 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
protected string $name;
|
protected string $name;
|
||||||
|
|
||||||
// Is this attribute an internal attribute
|
// Is this attribute an internal attribute
|
||||||
protected(set) bool $is_internal = FALSE;
|
protected ?bool $_is_internal = NULL;
|
||||||
protected(set) bool $no_attr_tags = FALSE;
|
protected(set) bool $no_attr_tags = FALSE;
|
||||||
|
|
||||||
// MIN/MAX number of values
|
// MIN/MAX number of values
|
||||||
@ -144,6 +144,8 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
'hints' => $this->hints(),
|
'hints' => $this->hints(),
|
||||||
// Can this attribute be edited
|
// Can this attribute be edited
|
||||||
'is_editable' => $this->schema ? $this->schema->{$key} : NULL,
|
'is_editable' => $this->schema ? $this->schema->{$key} : NULL,
|
||||||
|
// Is this an internal attribute
|
||||||
|
'is_internal' => is_null($this->_is_internal) ? ($this->used_in->count() === 0) : $this->_is_internal,
|
||||||
// Objectclasses that required this attribute for an LDAP entry
|
// Objectclasses that required this attribute for an LDAP entry
|
||||||
'required' => $this->required(),
|
'required' => $this->required(),
|
||||||
// Is this attribute an RDN attribute
|
// Is this attribute an RDN attribute
|
||||||
@ -157,7 +159,7 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
// 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
|
// The current attribute values
|
||||||
'values' => $this->no_attr_tags ? $this->tagValues() : $this->_values,
|
'values' => ($this->no_attr_tags || $this->is_internal) ? $this->tagValues() : $this->_values,
|
||||||
// The original attribute values
|
// The original attribute values
|
||||||
'values_old' => $this->no_attr_tags ? $this->tagValuesOld() : $this->_values_old,
|
'values_old' => $this->no_attr_tags ? $this->tagValuesOld() : $this->_values_old,
|
||||||
|
|
||||||
@ -313,6 +315,11 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View
|
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View
|
||||||
{
|
{
|
||||||
|
if ($this->is_internal)
|
||||||
|
// @note Internal attributes cannot be edited
|
||||||
|
return view('components.attribute.internal')
|
||||||
|
->with('o',$this);
|
||||||
|
|
||||||
$view = match ($this->schema?->syntax_oid) {
|
$view = match ($this->schema?->syntax_oid) {
|
||||||
self::SYNTAX_CERTIFICATE => view('components.syntax.certificate'),
|
self::SYNTAX_CERTIFICATE => view('components.syntax.certificate'),
|
||||||
self::SYNTAX_CERTIFICATE_LIST => view('components.syntax.certificatelist'),
|
self::SYNTAX_CERTIFICATE_LIST => view('components.syntax.certificatelist'),
|
||||||
|
@ -24,13 +24,7 @@ class Factory
|
|||||||
'cacertificate' => Certificate::class,
|
'cacertificate' => Certificate::class,
|
||||||
'certificaterevocationlist' => CertificateList::class,
|
'certificaterevocationlist' => CertificateList::class,
|
||||||
'createtimestamp' => Internal\Timestamp::class,
|
'createtimestamp' => Internal\Timestamp::class,
|
||||||
'creatorsname' => Internal\DN::class,
|
|
||||||
'configcontext' => Schema\Generic::class,
|
'configcontext' => Schema\Generic::class,
|
||||||
'contextcsn' => Internal\CSN::class,
|
|
||||||
'entrycsn' => Internal\CSN::class,
|
|
||||||
'entrydn' => Internal\DN::class,
|
|
||||||
'entryuuid' => Internal\UUID::class,
|
|
||||||
'etag' => Internal\Etag::class,
|
|
||||||
'krblastfailedauth' => Attribute\NoAttrTags\Generic::class,
|
'krblastfailedauth' => Attribute\NoAttrTags\Generic::class,
|
||||||
'krblastpwdchange' => Attribute\NoAttrTags\Generic::class,
|
'krblastpwdchange' => Attribute\NoAttrTags\Generic::class,
|
||||||
'krblastsuccessfulauth' => Attribute\NoAttrTags\Generic::class,
|
'krblastsuccessfulauth' => Attribute\NoAttrTags\Generic::class,
|
||||||
@ -39,17 +33,11 @@ class Factory
|
|||||||
'krbprincipalkey' => KrbPrincipalKey::class,
|
'krbprincipalkey' => KrbPrincipalKey::class,
|
||||||
'krbticketflags' => KrbTicketFlags::class,
|
'krbticketflags' => KrbTicketFlags::class,
|
||||||
'gidnumber' => GidNumber::class,
|
'gidnumber' => GidNumber::class,
|
||||||
'hassubordinates' => Internal\HasSubordinates::class,
|
|
||||||
'jpegphoto' => Binary\JpegPhoto::class,
|
'jpegphoto' => Binary\JpegPhoto::class,
|
||||||
'modifytimestamp' => Internal\Timestamp::class,
|
'modifytimestamp' => Internal\Timestamp::class,
|
||||||
'modifiersname' => Internal\DN::class,
|
|
||||||
'monitorcontext' => Schema\Generic::class,
|
'monitorcontext' => Schema\Generic::class,
|
||||||
'namingcontexts' => Schema\Generic::class,
|
'namingcontexts' => Schema\Generic::class,
|
||||||
'numsubordinates' => Internal\NumSubordinates::class,
|
|
||||||
'objectclass' => ObjectClass::class,
|
'objectclass' => ObjectClass::class,
|
||||||
'pwdpolicysubentry' => Internal\PwdPolicySubentry::class,
|
|
||||||
'structuralobjectclass' => Internal\StructuralObjectClass::class,
|
|
||||||
'subschemasubentry' => Internal\SubschemaSubentry::class,
|
|
||||||
'supportedcontrol' => Schema\OID::class,
|
'supportedcontrol' => Schema\OID::class,
|
||||||
'supportedextension' => Schema\OID::class,
|
'supportedextension' => Schema\OID::class,
|
||||||
'supportedfeatures' => Schema\OID::class,
|
'supportedfeatures' => Schema\OID::class,
|
||||||
|
@ -2,23 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute;
|
namespace App\Classes\LDAP\Attribute;
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute;
|
use App\Classes\LDAP\Attribute;
|
||||||
use App\Ldap\Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an attribute whose values are internal
|
* Represents an attribute whose values are internal
|
||||||
*/
|
*/
|
||||||
abstract class Internal extends Attribute
|
abstract class Internal extends Attribute
|
||||||
{
|
{
|
||||||
protected(set) bool $is_internal = TRUE;
|
protected ?bool $_is_internal = TRUE;
|
||||||
protected(set) bool $no_attr_tags = TRUE;
|
protected(set) bool $no_attr_tags = TRUE;
|
||||||
|
|
||||||
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View
|
|
||||||
{
|
|
||||||
// @note Internal attributes cannot be edited
|
|
||||||
return view('components.attribute.internal')
|
|
||||||
->with('o',$this);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an CSN Attribute
|
|
||||||
*/
|
|
||||||
final class CSN extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an DN Attribute
|
|
||||||
*/
|
|
||||||
final class DN extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an Etag Attribute
|
|
||||||
*/
|
|
||||||
final class Etag extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an HasSubordinates Attribute
|
|
||||||
*/
|
|
||||||
final class HasSubordinates extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an NumSubordinates Attribute
|
|
||||||
*/
|
|
||||||
final class NumSubordinates extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an PwdPolicySubentry Attribute
|
|
||||||
*/
|
|
||||||
final class PwdPolicySubentry extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an StructuralObjectClass Attribute
|
|
||||||
*/
|
|
||||||
final class StructuralObjectClass extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an SubschemaSubentry Attribute
|
|
||||||
*/
|
|
||||||
final class SubschemaSubentry extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute\Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an UUID Attribute
|
|
||||||
*/
|
|
||||||
final class UUID extends Internal
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $o=Internal::class -->
|
<!-- $o=Attribute|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 }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user