From 467cc87b8d84843ec9bd504c3525ac726bb785c1 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Tue, 21 Jul 2026 14:03:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=8E=E9=9D=99=E6=80=81=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utilities/Installer.php | 18 +++++++++++++++++- config/database.php | 8 ++++++-- database/seeds/Permissions.php | 4 ++-- public/public | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) create mode 120000 public/public diff --git a/app/Utilities/Installer.php b/app/Utilities/Installer.php index 85331462..20de3d76 100644 --- a/app/Utilities/Installer.php +++ b/app/Utilities/Installer.php @@ -4,6 +4,8 @@ namespace App\Utilities; use App\Jobs\Auth\CreateUser; use App\Jobs\Common\CreateCompany; +use App\Models\Auth\Permission; +use App\Models\Auth\Role; use App\Utilities\Console; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Config; @@ -244,17 +246,31 @@ class Installer 'locale' => $locale, 'enabled' => '1', ])); + + // This application uses one local ledger, so no setup wizard is needed. + setting()->set('wizard.completed', '1'); + setting()->save(); } public static function createUser($email, $password, $locale) { + $role = Role::where('name', SystemAccess::SUPER_ADMIN)->firstOrFail(); + $permission = Permission::firstOrCreate( + ['name' => 'read-admin-panel'], + ['display_name' => 'Read Admin Panel'] + ); + + if (! $role->hasPermission($permission->name)) { + $role->attachPermission($permission); + } + dispatch_sync(new CreateUser([ 'name' => '', 'email' => $email, 'password' => $password, 'locale' => $locale, 'companies' => ['1'], - 'roles' => ['1'], + 'roles' => [$role->id], 'enabled' => '1', ])); } diff --git a/config/database.php b/config/database.php index 6914f878..bd4cb8b0 100644 --- a/config/database.php +++ b/config/database.php @@ -2,6 +2,10 @@ use Illuminate\Support\Str; +$mysqlSslCaOption = class_exists(\Pdo\Mysql::class) + ? \Pdo\Mysql::ATTR_SSL_CA + : \PDO::MYSQL_ATTR_SSL_CA; + return [ /* @@ -77,7 +81,7 @@ return [ 'NO_ENGINE_SUBSTITUTION', ], 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + $mysqlSslCaOption => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], @@ -115,7 +119,7 @@ return [ 'NO_ENGINE_SUBSTITUTION', ], 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + $mysqlSslCaOption => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], diff --git a/database/seeds/Permissions.php b/database/seeds/Permissions.php index 5b3c1f1b..3dbcfebf 100644 --- a/database/seeds/Permissions.php +++ b/database/seeds/Permissions.php @@ -26,7 +26,7 @@ class Permissions extends Seeder private function create() { $rows = [ - 'admin' => [ + 'super_admin' => [ 'admin-panel' => 'r', 'api' => 'r', 'auth-profile' => 'r,u', @@ -80,7 +80,7 @@ class Permissions extends Seeder 'widgets-profit-loss' => 'r', 'widgets-receivables' => 'r', ], - 'manager' => [ + 'admin' => [ 'admin-panel' => 'r', 'auth-profile' => 'r,u', 'banking-accounts' => 'c,r,u,d', diff --git a/public/public b/public/public new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/public/public @@ -0,0 +1 @@ +. \ No newline at end of file