/
DATKAI
/
ITCUP
Обзор
Документация
Войти
/
DATKAI
/
ITCUP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
app/Filament/Pages/AdGroups.php
74 строки
2 KB
ITCUP Admin
feat(ad): интеграция с AD — настройки, просмотр пользователей и групп, импорт
22 апр 2026, 08:34
22 апр 2026, 08:34
62fb60c
Код
Авторство
О чём код?
<?php namespace App\Filament\Pages; use App\Services\LdapService; use BackedEnum; use Filament\Forms\Components\TextInput; use Filament\Forms\Concerns\InteractsWithForms; use Filament\Forms\Contracts\HasForms; use Filament\Pages\Page; use Filament\Schemas\Schema; use Filament\Support\Icons\Heroicon; use Throwable; class AdGroups extends Page implements HasForms { use InteractsWithForms; protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserGroup; protected static ?string $navigationLabel = 'Группы AD'; protected static string|\UnitEnum|null $navigationGroup = 'Настройки'; protected static ?int $navigationSort = 12; protected static ?string $title = 'Группы Active Directory'; protected string $view = 'filament.pages.ad-groups'; public ?string $search = ''; public array $groups = []; public ?string $error = null; public function mount(): void { $this->load(); } public function form(Schema $schema): Schema { return $schema->components([ TextInput::make('search') ->label('Поиск') ->placeholder('Название группы') ->live(debounce: 500) ->afterStateUpdated(fn () => $this->load()), ]); } public function load(): void { $this->error = null; $this->groups = []; try { $ldap = app(LdapService::class); $results = $ldap->listGroups(trim($this->search) ?: null, 200); foreach ($results as $g) { $this->groups[] = [ 'cn' => $g->getFirstAttribute('cn') ?: $g->getFirstAttribute('name'), 'dn' => $g->getDn(), 'description' => $g->getFirstAttribute('description'), 'member_count' => count($g->getAttribute('member') ?? []), ]; } } catch (Throwable $e) { $this->error = $e->getMessage(); } } }