Browse Source

限制超管无法删除无法编辑

master
wanghongjun 1 month ago
parent
commit
1a0f6776eb
  1. 3
      app/Services/AdminUsersService.php
  2. 3
      resources/lang/en/service.php
  3. 3
      resources/lang/zh-CN/service.php
  4. 3
      resources/lang/zh-TW/service.php

3
app/Services/AdminUsersService.php

@ -96,6 +96,9 @@ final class AdminUsersService
throw new Exception(__('service.admin_user.name_exists')); throw new Exception(__('service.admin_user.name_exists'));
} }
$model = AdminUsers::findOrFail($id); $model = AdminUsers::findOrFail($id);
if ($model['username'] == 'Admin' || $id == 1) {
throw new Exception(__('service.admin_user.not_edit'));
}
$oldValue = $model->toArray(); $oldValue = $model->toArray();
$update = [ $update = [
'username' => $data['username'], 'username' => $data['username'],

3
resources/lang/en/service.php

@ -7,7 +7,8 @@ return [
], ],
'admin_user' => [ 'admin_user' => [
'name_exists' => 'The user account already exists', 'name_exists' => 'The user account already exists',
'not_del' => 'Super management account cannot be deleted' 'not_del' => 'Super management account cannot be deleted',
'not_edit' => 'Super management account cannot be edited'
], ],
'admin_translation' => [ 'admin_translation' => [
'data_exists' => 'Translation configuration already exists' 'data_exists' => 'Translation configuration already exists'

3
resources/lang/zh-CN/service.php

@ -7,7 +7,8 @@ return [
], ],
'admin_user' => [ 'admin_user' => [
'name_exists' => '用户账号已存在', 'name_exists' => '用户账号已存在',
'not_del' => '超管账号不可删除' 'not_del' => '超管账号不可删除',
'not_edit' => '超管账号不可编辑'
], ],
'admin_translation' => [ 'admin_translation' => [
'data_exists' => '翻译配置已存在' 'data_exists' => '翻译配置已存在'

3
resources/lang/zh-TW/service.php

@ -7,7 +7,8 @@ return [
], ],
'admin_user' => [ 'admin_user' => [
'name_exists' => '用戶帳號已存在', 'name_exists' => '用戶帳號已存在',
'not_del' => '超管帳號不可删除' 'not_del' => '超管帳號不可删除',
'not_edit' => '超管帳號不可編輯'
], ],
'admin_translation' => [ 'admin_translation' => [
'data_exists' => '翻譯配寘已存在' 'data_exists' => '翻譯配寘已存在'

Loading…
Cancel
Save