More work on displaying and editing an LDAP entry

This commit is contained in:
2023-04-02 22:07:15 +10:00
parent d6f833f6eb
commit 4fd51abcb1
25 changed files with 194 additions and 91 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Classes\LDAP\Attribute\Schema;
use Illuminate\Contracts\View\View;
use App\Classes\LDAP\Attribute\Schema;
/**
@@ -9,21 +11,6 @@ use App\Classes\LDAP\Attribute\Schema;
*/
final class Mechanisms extends Schema
{
public function __toString(): string
{
return $this->values
->transform(function($item) {
$format = sprintf('<abbr class="pb-1" title="%s"><i class="fas fa-book pe-2"></i>%s</abbr>%s<p class="mb-0">%s</p>',
$item,
static::get($item,'title'),
($x=static::get($item,'ref')) ? sprintf('<abbr class="ps-2" title="%s"><i class="fas fa-comment-dots"></i></abbr>',$x) : '',
static::get($item,'desc'),
);
return $format;
})->join('<br>');
}
/**
* Given an SASL Mechanism name, returns a verbose description of the Mechanism.
* This function parses ldap_supported_saslmechanisms.txt and looks up the specified
@@ -41,8 +28,15 @@ final class Mechanisms extends Schema
* @param string $key The title|ref|desc to return
* @return string|NULL
*/
protected static function get(string $string,string $key): ?string
public static function get(string $string,string $key): ?string
{
return parent::_get(config_path('ldap_supported_saslmechanisms.txt'),$string,$key);
}
public function render(bool $edit=FALSE): View
{
// @note Schema attributes cannot be edited
return view('components.attribute.schema.mechanisms')
->with('o',$this);
}
}