mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-25 06:56:32 +08:00
fix: Fix the mysql root account permission switchover exception (#8378)
Some checks failed
SonarCloud Scan / SonarCloud (push) Has been cancelled
Some checks failed
SonarCloud Scan / SonarCloud (push) Has been cancelled
This commit is contained in:
parent
e7670f96de
commit
600b769083
3 changed files with 32 additions and 26 deletions
|
|
@ -188,19 +188,18 @@ func (r *Local) ChangeAccess(info AccessChangeInfo) error {
|
|||
info.Name = "*"
|
||||
info.Password = r.Password
|
||||
}
|
||||
if info.Permission == info.OldPermission {
|
||||
return nil
|
||||
}
|
||||
if err := r.Delete(DeleteInfo{
|
||||
Version: info.Version,
|
||||
Username: info.Username,
|
||||
Permission: info.OldPermission,
|
||||
ForceDelete: true,
|
||||
Timeout: 300}); err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Username == "root" {
|
||||
return nil
|
||||
if info.Permission != info.OldPermission {
|
||||
if err := r.Delete(DeleteInfo{
|
||||
Version: info.Version,
|
||||
Username: info.Username,
|
||||
Permission: info.OldPermission,
|
||||
ForceDelete: true,
|
||||
Timeout: 300}); err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Username == "root" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if err := r.CreateUser(CreateInfo{
|
||||
Name: info.Name,
|
||||
|
|
|
|||
|
|
@ -199,19 +199,18 @@ func (r *Remote) ChangeAccess(info AccessChangeInfo) error {
|
|||
info.Name = "*"
|
||||
info.Password = r.Password
|
||||
}
|
||||
if info.Permission == info.OldPermission {
|
||||
return nil
|
||||
}
|
||||
if err := r.Delete(DeleteInfo{
|
||||
Version: info.Version,
|
||||
Username: info.Username,
|
||||
Permission: info.OldPermission,
|
||||
ForceDelete: true,
|
||||
Timeout: 300}); err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Username == "root" {
|
||||
return nil
|
||||
if info.Permission != info.OldPermission {
|
||||
if err := r.Delete(DeleteInfo{
|
||||
Version: info.Version,
|
||||
Username: info.Username,
|
||||
Permission: info.OldPermission,
|
||||
ForceDelete: true,
|
||||
Timeout: 300}); err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Username == "root" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if err := r.CreateUser(CreateInfo{
|
||||
Name: info.Name,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ const changeVisible = ref(false);
|
|||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const changeFormRef = ref<FormInstance>();
|
||||
const title = ref();
|
||||
const oldPrivilege = ref();
|
||||
const oldPrivilegeIPs = ref();
|
||||
const changeForm = reactive({
|
||||
id: 0,
|
||||
from: '',
|
||||
|
|
@ -124,6 +126,8 @@ const acceptParams = (params: DialogProps): void => {
|
|||
changeForm.privilegeIPs = params.privilegeIPs;
|
||||
changeForm.value = params.value;
|
||||
changeVisible.value = true;
|
||||
oldPrivilege.value = params.privilege;
|
||||
oldPrivilegeIPs.value = params.privilegeIPs;
|
||||
};
|
||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||
|
||||
|
|
@ -167,6 +171,10 @@ const submitChangeInfo = async (formEl: FormInstance | undefined) => {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (changeForm.privilege === oldPrivilege.value && changeForm.privilegeIPs === oldPrivilegeIPs.value) {
|
||||
changeVisible.value = false;
|
||||
return;
|
||||
}
|
||||
if (changeForm.privilege !== 'ip') {
|
||||
param.value = changeForm.privilege;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue