WIP
Signed-off-by: Nguyen Van Nguyen <nguyennv1981@gmail.com>
This commit is contained in:
parent
8d8edc3aeb
commit
954be77bea
5 changed files with 11 additions and 6 deletions
|
@ -21,16 +21,16 @@ enum UserRole: string implements HasLabel
|
|||
{
|
||||
case Administrator = 'administrator';
|
||||
case Agency = 'agency';
|
||||
case DomainManager = 'domain-manager';
|
||||
case GroupManager = 'group-manager';
|
||||
case DomainAdmin = 'domain-admin';
|
||||
case GroupAdmin = 'group-admin';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Administrator => __('Administrator'),
|
||||
self::Agency => __('Agency'),
|
||||
self::DomainManager => __('Domain Manager'),
|
||||
self::GroupManager => __('Group Manager'),
|
||||
self::DomainAdmin => __('Domain Admin'),
|
||||
self::GroupAdmin => __('Group Admin'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ class ManageZimbraSettings extends SettingsPage
|
|||
->required()->label(__('Admin User')),
|
||||
TextInput::make('adminPassword')
|
||||
->password()->required()->label(__('Admin Password')),
|
||||
TextInput::make('defaultDomain')
|
||||
->required()->label(__('Default Domain')),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace App\Filament\Resources\UserResource\Pages;
|
|||
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Resources\UserResource;
|
||||
use App\Models\Domain;
|
||||
use App\Settings\ZimbraSettings;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Components\{
|
||||
Select,
|
||||
|
@ -39,7 +39,7 @@ class CreateUser extends CreateRecord
|
|||
TextInput::make('name')->required()->label(__('Name')),
|
||||
TextInput::make('email')->email()->required()->unique()
|
||||
->endsWith(
|
||||
Domain::all()->pluck('name', 'name')
|
||||
app(ZimbraSettings::class)->defaultDomain
|
||||
)->validationMessages([
|
||||
'unique' => __('The email address has already been taken.'),
|
||||
'ends_with' => __('The email address does not belong to any domains.'),
|
||||
|
|
|
@ -25,6 +25,8 @@ class ZimbraSettings extends Settings
|
|||
|
||||
public string $adminPassword;
|
||||
|
||||
public string $defaultDomain;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'zimbra';
|
||||
|
|
|
@ -9,5 +9,6 @@ return new class extends SettingsMigration
|
|||
$this->migrator->add('zimbra.serviceUrl', '');
|
||||
$this->migrator->add('zimbra.adminUser', '');
|
||||
$this->migrator->addEncrypted('zimbra.adminPassword', '');
|
||||
$this->migrator->add('zimbra.defaultDomain', '');
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue