Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -3,6 +3,7 @@
namespace Kirby\Panel;
use Kirby\Cms\File as CmsFile;
use Kirby\Cms\ModelWithContent;
use Kirby\Cms\Translation;
use Kirby\Cms\Url;
use Kirby\Filesystem\Asset;
@@ -20,6 +21,11 @@ use Kirby\Toolkit\I18n;
*/
class User extends Model
{
/**
* @var \Kirby\Cms\User
*/
protected ModelWithContent $model;
/**
* Breadcrumb array
*/
@@ -67,6 +73,15 @@ class User extends Model
'disabled' => $this->isDisabledDropdownOption('changeRole', $options, $permissions)
];
$result[] = [
'dialog' => $url . '/changeLanguage',
'icon' => 'translate',
'text' => I18n::translate('user.changeLanguage'),
'disabled' => $this->isDisabledDropdownOption('changeLanguage', $options, $permissions)
];
$result[] = '-';
$result[] = [
'dialog' => $url . '/changePassword',
'icon' => 'key',
@@ -74,12 +89,23 @@ class User extends Model
'disabled' => $this->isDisabledDropdownOption('changePassword', $options, $permissions)
];
$result[] = [
'dialog' => $url . '/changeLanguage',
'icon' => 'globe',
'text' => I18n::translate('user.changeLanguage'),
'disabled' => $this->isDisabledDropdownOption('changeLanguage', $options, $permissions)
];
if ($this->model->kirby()->system()->is2FAWithTOTP() === true) {
if ($account || $this->model->kirby()->user()->isAdmin()) {
if ($this->model->secret('totp') !== null) {
$result[] = [
'dialog' => $url . '/totp/disable',
'icon' => 'qr-code',
'text' => I18n::translate('login.totp.disable.option'),
];
} elseif ($account) {
$result[] = [
'dialog' => $url . '/totp/enable',
'icon' => 'qr-code',
'text' => I18n::translate('login.totp.enable.option')
];
}
}
}
$result[] = '-';
@@ -194,7 +220,6 @@ class User extends Model
{
$user = $this->model;
$account = $user->isLoggedIn();
$avatar = $user->avatar();
return array_merge(
parent::props(),
@@ -203,7 +228,7 @@ class User extends Model
'blueprint' => $this->model->role()->name(),
'model' => [
'account' => $account,
'avatar' => $avatar ? $avatar->url() : null,
'avatar' => $user->avatar()?->url(),
'content' => $this->content(),
'email' => $user->email(),
'id' => $user->id(),