6067-vnUser_privileges_and_verifyEmail #1764

Merged
alexm merged 15 commits from 6067-vnUser_privileges_and_verifyEmail into dev 2023-10-19 12:13:20 +00:00
Member
No description provided.
alexm added 2 commits 2023-09-25 06:17:01 +00:00
gitea/salix/pipeline/head There was a failure building this commit Details
3b90d7e5e5
refs #6067 refactor: vnUser and mailForward privileges. fix: emailVerification
gitea/salix/pipeline/head There was a failure building this commit Details
a78348f2de
refs #6067 feat(account_basicData): use vnUser/preview
alexm added 2 commits 2023-09-25 06:33:28 +00:00
alexm reviewed 2023-09-25 06:40:03 +00:00
@ -222,0 +204,4 @@
Self.observe('after save', async ctx => {
const newEmail = ctx?.instance?.email;
const oldEmail = ctx?.hookState?.oldInstance?.email;
if (!ctx.isNewInstance && (!newEmail || !oldEmail || newEmail == oldEmail)) return;
Author
Member

Sobre isNewInstance.
Mirar la nota https://redmine.verdnatura.es/issues/5761#note-8

Sobre isNewInstance. Mirar la nota https://redmine.verdnatura.es/issues/5761#note-8
alexm marked this conversation as resolved
juan requested changes 2023-09-27 09:03:10 +00:00
@ -0,0 +35,4 @@
Self.updateUser = async(ctx, id) => {
await Self.userSecurity(ctx, id);
const user = await Self.app.models.VnUser.findById(id,
{fields: ['id', 'name', 'nickname', 'email', 'lang', 'password']});
Owner

En lugar de hacer findById y luego updateAttributes, utilizar upsert.

En lugar de hacer `findById` y luego `updateAttributes`, utilizar `upsert`.
alexm marked this conversation as resolved
@ -0,0 +36,4 @@
await Self.userSecurity(ctx, id);
const user = await Self.app.models.VnUser.findById(id,
{fields: ['id', 'name', 'nickname', 'email', 'lang', 'password']});
await user.updateAttributes(ctx.args);
Owner

En lugar de utilizar ctx.args listar parámetros en la definición de la función y pasarlos todos excepto el id.

En lugar de utilizar `ctx.args` listar parámetros en la definición de la función y pasarlos todos excepto el `id`.
alexm marked this conversation as resolved
@ -216,3 +201,1 @@
// protocol: url[0],
// user: Self
// };
throw new UserError(`You don't have enough privileges`);
Owner

En lugar de lanzar UserError lanzar ForbiddenError.

En lugar de lanzar `UserError` lanzar `ForbiddenError`.
alexm marked this conversation as resolved
@ -222,0 +231,4 @@
type: 'email',
to: newEmail,
from: {},
redirect: `${origin}/#!/account/${ctx.instance.id}/basic-data?emailConfirmed`,
Owner

Redirigir a un (nuevo) subestado verifyEmail del login de Lilium donde, en función de si el usuario tiene account, mostrar "Ir a la tienda" o "Iniciar sesión".

Redirigir a un (nuevo) subestado `verifyEmail` del login de Lilium donde, en función de si el usuario tiene account, mostrar "Ir a la tienda" o "Iniciar sesión".
alexm marked this conversation as resolved
@ -0,0 +4,4 @@
('VnUser', 'mediumPrivileges', '*', 'ALLOW', 'ROLE', 'hr'),
('VnUser', 'updateUser', '*', 'ALLOW', 'ROLE', 'employee');
ALTER TABLE `account`.`user` ADD `username` varchar(30) AS (name) VIRTUAL;
Owner

Probar si la nueva columna virtual username es actualizable.

Probar si la nueva columna virtual `username` es actualizable.
alexm marked this conversation as resolved
@ -0,0 +7,4 @@
Self.observe('before delete', async ctx => {
await Self.app.models.VnUser.userSecurity(ctx, ctx.where.account);
});
};
Owner

Este código no es necesario, solo hay que verificar userSecurity al cambiar el correo de recuperación.

Este código no es necesario, solo hay que verificar `userSecurity` al cambiar el correo de recuperación.
alexm marked this conversation as resolved
alexm added 2 commits 2023-10-02 12:52:08 +00:00
alexm reviewed 2023-10-03 07:33:51 +00:00
@ -155,6 +155,7 @@ module.exports = Self => {
password: randomPassword.password,
email: args.email,
roleFk: workerConfig.roleFk,
isWorker: true // to verifyEmail
Author
Member

Aço ho he tingut que ficar pq no hi ha forma de si el crees saber que es un treballador no...
Se me ha ocurrit ficarli un paremetre mes que no es gasta per res mes, pero no me acaba la solució.

Tb se podria ficar en el ctx.options algo com isNewWorker o algo

Aço ho he tingut que ficar pq no hi ha forma de si el crees saber que es un treballador no... Se me ha ocurrit ficarli un paremetre mes que no es gasta per res mes, pero no me acaba la solució. Tb se podria ficar en el ctx.options algo com isNewWorker o algo
alexm marked this conversation as resolved
alexm added 2 commits 2023-10-03 07:36:18 +00:00
alexm changed title from WIP: 6067-vnUser_privileges_and_verifyEmail to 6067-vnUser_privileges_and_verifyEmail 2023-10-03 07:36:26 +00:00
alexm requested review from juan 2023-10-03 07:37:12 +00:00
alexm added 4 commits 2023-10-18 06:52:38 +00:00
juan approved these changes 2023-10-19 08:13:51 +00:00
Dismissed
alexm added 1 commit 2023-10-19 08:50:36 +00:00
alexm dismissed juan’s review 2023-10-19 08:50:37 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

alexm added 1 commit 2023-10-19 10:48:58 +00:00
gitea/salix/pipeline/head There was a failure building this commit Details
1ea6b87266
Merge branch 'dev' into 6067-vnUser_privileges_and_verifyEmail
alexm added 1 commit 2023-10-19 11:36:23 +00:00
juan approved these changes 2023-10-19 12:12:53 +00:00
alexm merged commit 44b2155c2b into dev 2023-10-19 12:13:20 +00:00
alexm deleted branch 6067-vnUser_privileges_and_verifyEmail 2023-10-19 12:13:20 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix#1764
No description provided.