diff --git a/back/model-config.json b/back/model-config.json index a2cd88756d..f7b6efe63c 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -142,6 +142,9 @@ }, "PrintConfig": { "dataSource": "vn" + }, + "user": { + "dataSource": "vn" } } diff --git a/back/models/user.json b/back/models/user.json new file mode 100644 index 0000000000..1aa1838b4c --- /dev/null +++ b/back/models/user.json @@ -0,0 +1,19 @@ +{ + "name": "user", + "base": "User", + "options": { + "mysql": { + "table": "salix.User" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "username":{ + "type": "string" + } + } + } \ No newline at end of file diff --git a/db/changes/230401/00-User.sql b/db/changes/230401/00-User.sql new file mode 100644 index 0000000000..6c80d2c2dd --- /dev/null +++ b/db/changes/230401/00-User.sql @@ -0,0 +1,21 @@ +create or replace definer = root@localhost view User as +select `account`.`user`.`id` AS `id`, + `account`.`user`.`realm` AS `realm`, + `account`.`user`.`name` AS `name`, + `account`.`user`.`nickname` AS `nickname`, + `account`.`user`.`bcryptPassword` AS `password`, + `account`.`user`.`role` AS `role`, + `account`.`user`.`active` AS `active`, + `account`.`user`.`email` AS `email`, + `account`.`user`.`emailVerified` AS `emailVerified`, + `account`.`user`.`verificationToken` AS `verificationToken`, + `account`.`user`.`lang` AS `lang`, + `account`.`user`.`lastPassChange` AS `lastPassChange`, + `account`.`user`.`created` AS `created`, + `account`.`user`.`updated` AS `updated`, + `account`.`user`.`image` AS `image`, + `account`.`user`.`recoverPass` AS `recoverPass`, + `account`.`user`.`sync` AS `sync`, + `account`.`user`.`hasGrant` AS `hasGrant` +from `account`.`user`; + diff --git a/modules/account/back/models/account-config.js b/modules/account/back/models/account-config.js index 5c9d92f1e0..fd0bf04358 100644 --- a/modules/account/back/models/account-config.js +++ b/modules/account/back/models/account-config.js @@ -177,7 +177,7 @@ module.exports = Self => { async syncUser(userName, info, password) { if (info.user && password) - await app.models.VnUser.setPassword(info.user.id, password); + await app.models.user.setPassword(info.user.id, password); }, async getUsers(usersToSync) {