refs #5036 removed grabUserLog function
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
9ff920c67e
commit
e66974f77f
|
@ -328,8 +328,11 @@ class VnMySQL extends MySQL {
|
||||||
// Fetch old values (update|delete) or login
|
// Fetch old values (update|delete) or login
|
||||||
let where, id, data, idName, limit, op, oldInstances, newInstances;
|
let where, id, data, idName, limit, op, oldInstances, newInstances;
|
||||||
const hasGrabUser = settings.log && settings.log.grabUser;
|
const hasGrabUser = settings.log && settings.log.grabUser;
|
||||||
if(hasGrabUser)
|
if(hasGrabUser){
|
||||||
await this.grabUserLog(Model, opts, 'login');
|
const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId;
|
||||||
|
const user = await Model.app.models.Account.findById(userId, {fields: ['name']}, opts);
|
||||||
|
await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
where = ctx.where;
|
where = ctx.where;
|
||||||
id = ctx.id;
|
id = ctx.id;
|
||||||
|
@ -363,7 +366,7 @@ class VnMySQL extends MySQL {
|
||||||
});
|
});
|
||||||
|
|
||||||
if(hasGrabUser)
|
if(hasGrabUser)
|
||||||
await this.grabUserLog(Model, opts, 'logout');
|
await this.executeP(`CALL account.myUser_logout()`, null, opts);
|
||||||
else {
|
else {
|
||||||
// Fetch new values
|
// Fetch new values
|
||||||
const ids = [];
|
const ids = [];
|
||||||
|
@ -402,17 +405,6 @@ class VnMySQL extends MySQL {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async grabUserLog(Model, opts, action) {
|
|
||||||
if(action == 'login'){
|
|
||||||
const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId;
|
|
||||||
const user = await Model.app.models.Account.findById(userId, {fields: ['name']}, opts);
|
|
||||||
await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts);
|
|
||||||
}
|
|
||||||
else if(action == 'logout')
|
|
||||||
await this.executeP(`CALL account.myUser_logout()`, null, opts);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
buildSelectStmt(op, data, idName, model, where, limit) {
|
buildSelectStmt(op, data, idName, model, where, limit) {
|
||||||
const Model = this.getModelDefinition(model).model;
|
const Model = this.getModelDefinition(model).model;
|
||||||
const properties = Object.keys(Model.definition.properties);
|
const properties = Object.keys(Model.definition.properties);
|
||||||
|
|
Loading…
Reference in New Issue