File tree 3 files changed +32
-26
lines changed
backend/utils/mysql/client
frontend/src/views/database/mysql/password
3 files changed +32
-26
lines changed Original file line number Diff line number Diff line change @@ -188,19 +188,18 @@ func (r *Local) ChangeAccess(info AccessChangeInfo) error {
188
188
info .Name = "*"
189
189
info .Password = r .Password
190
190
}
191
- if info .Permission == info .OldPermission {
192
- return nil
193
- }
194
- if err := r .Delete (DeleteInfo {
195
- Version : info .Version ,
196
- Username : info .Username ,
197
- Permission : info .OldPermission ,
198
- ForceDelete : true ,
199
- Timeout : 300 }); err != nil {
200
- return err
201
- }
202
- if info .Username == "root" {
203
- return nil
191
+ if info .Permission != info .OldPermission {
192
+ if err := r .Delete (DeleteInfo {
193
+ Version : info .Version ,
194
+ Username : info .Username ,
195
+ Permission : info .OldPermission ,
196
+ ForceDelete : true ,
197
+ Timeout : 300 }); err != nil {
198
+ return err
199
+ }
200
+ if info .Username == "root" {
201
+ return nil
202
+ }
204
203
}
205
204
if err := r .CreateUser (CreateInfo {
206
205
Name : info .Name ,
Original file line number Diff line number Diff line change @@ -199,19 +199,18 @@ func (r *Remote) ChangeAccess(info AccessChangeInfo) error {
199
199
info .Name = "*"
200
200
info .Password = r .Password
201
201
}
202
- if info .Permission == info .OldPermission {
203
- return nil
204
- }
205
- if err := r .Delete (DeleteInfo {
206
- Version : info .Version ,
207
- Username : info .Username ,
208
- Permission : info .OldPermission ,
209
- ForceDelete : true ,
210
- Timeout : 300 }); err != nil {
211
- return err
212
- }
213
- if info .Username == "root" {
214
- return nil
202
+ if info .Permission != info .OldPermission {
203
+ if err := r .Delete (DeleteInfo {
204
+ Version : info .Version ,
205
+ Username : info .Username ,
206
+ Permission : info .OldPermission ,
207
+ ForceDelete : true ,
208
+ Timeout : 300 }); err != nil {
209
+ return err
210
+ }
211
+ if info .Username == "root" {
212
+ return nil
213
+ }
215
214
}
216
215
if err := r .CreateUser (CreateInfo {
217
216
Name : info .Name ,
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ const changeVisible = ref(false);
74
74
type FormInstance = InstanceType <typeof ElForm >;
75
75
const changeFormRef = ref <FormInstance >();
76
76
const title = ref ();
77
+ const oldPrivilege = ref ();
78
+ const oldPrivilegeIPs = ref ();
77
79
const changeForm = reactive ({
78
80
id: 0 ,
79
81
from: ' ' ,
@@ -124,6 +126,8 @@ const acceptParams = (params: DialogProps): void => {
124
126
changeForm .privilegeIPs = params .privilegeIPs ;
125
127
changeForm .value = params .value ;
126
128
changeVisible .value = true ;
129
+ oldPrivilege .value = params .privilege ;
130
+ oldPrivilegeIPs .value = params .privilegeIPs ;
127
131
};
128
132
const emit = defineEmits <{ (e : ' search' ): void }>();
129
133
@@ -167,6 +171,10 @@ const submitChangeInfo = async (formEl: FormInstance | undefined) => {
167
171
}
168
172
return ;
169
173
}
174
+ if (changeForm .privilege === oldPrivilege .value && changeForm .privilegeIPs === oldPrivilegeIPs .value ) {
175
+ changeVisible .value = false ;
176
+ return ;
177
+ }
170
178
if (changeForm .privilege !== ' ip' ) {
171
179
param .value = changeForm .privilege ;
172
180
} else {
You can’t perform that action at this time.
0 commit comments