2023-03-01 22:54:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Classes\LDAP\Attribute;
|
|
|
|
|
2023-04-02 12:07:15 +00:00
|
|
|
use Illuminate\Contracts\View\View;
|
2023-04-11 22:17:57 +00:00
|
|
|
use Illuminate\Support\Collection;
|
2023-04-02 12:07:15 +00:00
|
|
|
|
2023-03-01 22:54:30 +00:00
|
|
|
use App\Classes\LDAP\Attribute;
|
|
|
|
|
|
|
|
/**
|
2023-03-02 07:21:53 +00:00
|
|
|
* Represents an ObjectClass Attribute
|
2023-03-01 22:54:30 +00:00
|
|
|
*/
|
|
|
|
final class ObjectClass extends Attribute
|
|
|
|
{
|
2023-04-11 22:17:57 +00:00
|
|
|
// Which of the values is the structural object class
|
|
|
|
protected Collection $structural;
|
|
|
|
|
|
|
|
public function __construct(string $name,array $values)
|
2023-04-02 12:07:15 +00:00
|
|
|
{
|
2023-04-11 22:17:57 +00:00
|
|
|
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);
|
2023-04-02 12:07:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-11 22:17:57 +00:00
|
|
|
/**
|
|
|
|
* Is a specific value the structural objectclass
|
|
|
|
*
|
|
|
|
* @param string $value
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isStructural(string $value): bool
|
|
|
|
{
|
|
|
|
return $this->structural->search($value) !== FALSE;
|
|
|
|
}
|
|
|
|
|
2023-09-02 10:50:54 +00:00
|
|
|
public function render(bool $edit=FALSE,bool $blank=FALSE): View
|
2023-03-01 22:54:30 +00:00
|
|
|
{
|
2023-04-02 12:07:15 +00:00
|
|
|
return view('components.attribute.objectclass')
|
|
|
|
->with('edit',$edit)
|
|
|
|
->with('o',$this);
|
2023-03-01 22:54:30 +00:00
|
|
|
}
|
|
|
|
}
|