mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-26 00:36:12 +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.Name = "*"
|
||||||
info.Password = r.Password
|
info.Password = r.Password
|
||||||
}
|
}
|
||||||
if info.Permission == info.OldPermission {
|
if info.Permission != info.OldPermission {
|
||||||
return nil
|
if err := r.Delete(DeleteInfo{
|
||||||
}
|
Version: info.Version,
|
||||||
if err := r.Delete(DeleteInfo{
|
Username: info.Username,
|
||||||
Version: info.Version,
|
Permission: info.OldPermission,
|
||||||
Username: info.Username,
|
ForceDelete: true,
|
||||||
Permission: info.OldPermission,
|
Timeout: 300}); err != nil {
|
||||||
ForceDelete: true,
|
return err
|
||||||
Timeout: 300}); err != nil {
|
}
|
||||||
return err
|
if info.Username == "root" {
|
||||||
}
|
return nil
|
||||||
if info.Username == "root" {
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if err := r.CreateUser(CreateInfo{
|
if err := r.CreateUser(CreateInfo{
|
||||||
Name: info.Name,
|
Name: info.Name,
|
||||||
|
|
|
||||||
|
|
@ -199,19 +199,18 @@ func (r *Remote) ChangeAccess(info AccessChangeInfo) error {
|
||||||
info.Name = "*"
|
info.Name = "*"
|
||||||
info.Password = r.Password
|
info.Password = r.Password
|
||||||
}
|
}
|
||||||
if info.Permission == info.OldPermission {
|
if info.Permission != info.OldPermission {
|
||||||
return nil
|
if err := r.Delete(DeleteInfo{
|
||||||
}
|
Version: info.Version,
|
||||||
if err := r.Delete(DeleteInfo{
|
Username: info.Username,
|
||||||
Version: info.Version,
|
Permission: info.OldPermission,
|
||||||
Username: info.Username,
|
ForceDelete: true,
|
||||||
Permission: info.OldPermission,
|
Timeout: 300}); err != nil {
|
||||||
ForceDelete: true,
|
return err
|
||||||
Timeout: 300}); err != nil {
|
}
|
||||||
return err
|
if info.Username == "root" {
|
||||||
}
|
return nil
|
||||||
if info.Username == "root" {
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if err := r.CreateUser(CreateInfo{
|
if err := r.CreateUser(CreateInfo{
|
||||||
Name: info.Name,
|
Name: info.Name,
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ const changeVisible = ref(false);
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const changeFormRef = ref<FormInstance>();
|
const changeFormRef = ref<FormInstance>();
|
||||||
const title = ref();
|
const title = ref();
|
||||||
|
const oldPrivilege = ref();
|
||||||
|
const oldPrivilegeIPs = ref();
|
||||||
const changeForm = reactive({
|
const changeForm = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
from: '',
|
from: '',
|
||||||
|
|
@ -124,6 +126,8 @@ const acceptParams = (params: DialogProps): void => {
|
||||||
changeForm.privilegeIPs = params.privilegeIPs;
|
changeForm.privilegeIPs = params.privilegeIPs;
|
||||||
changeForm.value = params.value;
|
changeForm.value = params.value;
|
||||||
changeVisible.value = true;
|
changeVisible.value = true;
|
||||||
|
oldPrivilege.value = params.privilege;
|
||||||
|
oldPrivilegeIPs.value = params.privilegeIPs;
|
||||||
};
|
};
|
||||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||||
|
|
||||||
|
|
@ -167,6 +171,10 @@ const submitChangeInfo = async (formEl: FormInstance | undefined) => {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (changeForm.privilege === oldPrivilege.value && changeForm.privilegeIPs === oldPrivilegeIPs.value) {
|
||||||
|
changeVisible.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (changeForm.privilege !== 'ip') {
|
if (changeForm.privilege !== 'ip') {
|
||||||
param.value = changeForm.privilege;
|
param.value = changeForm.privilege;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue