5488-use_checkAccessAcl #1482

Merged
alexm merged 32 commits from 5488-use_checkAccessAcl into dev 2023-05-29 05:20:29 +00:00
Member
No description provided.
alexm added 10 commits 2023-04-25 12:18:26 +00:00
alexm changed title from 5488-use_checkAccessAcl to WIP: 5488-use_checkAccessAcl 2023-04-25 12:18:29 +00:00
alexm reviewed 2023-04-25 12:20:12 +00:00
@ -0,0 +1,28 @@
-- DmsType model
Author
Member

Aqui combierto los writeRoles y readRoles en ACLs

Aqui combierto los writeRoles y readRoles en ACLs
alexm marked this conversation as resolved
alexm reviewed 2023-04-25 12:21:59 +00:00
@ -0,0 +54,4 @@
AND property = '*'
AND accessType = 'READ';
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
Author
Member

He medio arreglado State, habria que hacer lo mismo con los otros y revisar todas sus rutas para que tenga el ACL ademas de que tambien se deben poner los ACLs para write si fuera el caso.

Al final de la pagina estan todos las predeterminadas de loopback: https://loopback.io/doc/en/lb2/Controlling-data-access.html

He medio arreglado State, habria que hacer lo mismo con los otros y revisar todas sus rutas para que tenga el ACL ademas de que tambien se deben poner los ACLs para write si fuera el caso. Al final de la pagina estan todos las predeterminadas de loopback: https://loopback.io/doc/en/lb2/Controlling-data-access.html
alexm reviewed 2023-04-25 12:23:36 +00:00
@ -133,2 +133,3 @@
try {
const isSalesAssistant = await models.VnUser.hasRole(userId, 'salesAssistant', myOptions);
const canEditNotTaxDataChecked =
await models.ACL.checkAccessAcl(ctx, 'Client', 'editFiscalDataWithoutTaxDataCheck', 'WRITE');
Author
Member

Igual es demasiado largo pero no sabia como ponerlo

Igual es demasiado largo pero no sabia como ponerlo
jgallego requested changes 2023-04-26 07:03:50 +00:00
@ -72,3 +72,3 @@
try {
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId);
const hasWriteRole = await models.DmsType.checkRole(ctx, args.dmsTypeId, 'WRITE');
Owner

este no es necesario

este no es necesario
alexm marked this conversation as resolved
@ -67,3 +67,3 @@
let srcFile;
try {
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId, myOptions);
const hasWriteRole = await models.DmsType.checkRole(ctx, args.dmsTypeId, 'WRITE');
Owner

este també estaba be, no cal tocar estos arxius

este també estaba be, no cal tocar estos arxius
alexm marked this conversation as resolved
@ -1,65 +1,18 @@
module.exports = Self => {
/**
Owner

este archiu cal deixarlo com estaba perque DmsType ja te la seua gestio de rols concreta

este archiu cal deixarlo com estaba perque DmsType ja te la seua gestio de rols concreta
alexm marked this conversation as resolved
@ -48,0 +47,4 @@
"permission": "ALLOW"
},
{
"property": "findById",
Owner

per a que es necesari açò?

per a que es necesari açò?
alexm marked this conversation as resolved
@ -0,0 +10,4 @@
JOIN `account`.`role` r ON r.id = d.readRoleFk;
-- ImageCollection model
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
Owner

el problema d'este enfoque es que no es igual.
imageCollection hi ha que deixarlo com estaba perque ara li dones permis a tota la taula a un rol.
Pero lo que es necesita es donar permisos a certs usuaris per a certs tipos de imatges

el problema d'este enfoque es que no es igual. imageCollection hi ha que deixarlo com estaba perque ara li dones permis a tota la taula a un rol. Pero lo que es necesita es donar permisos a certs usuaris per a certs tipos de imatges
alexm marked this conversation as resolved
alexm added 1 commit 2023-04-28 07:35:33 +00:00
gitea/salix/pipeline/head There was a failure building this commit Details
42e3c8f29d
refs #5488 fix(): use hasWriteRole
alexm added 1 commit 2023-04-28 09:54:20 +00:00
gitea/salix/pipeline/head This commit looks good Details
c3038a4d61
fix(imageCollection):
alexm reviewed 2023-04-28 09:55:03 +00:00
@ -68,3 +68,3 @@
if (!image) return false;
const hasReadRole = models.ImageCollection.hasReadRole(ctx, collection);
const hasReadRole = await models.ImageCollection.hasReadRole(ctx, collection);
Author
Member

Aço dua 3 anys mal (sempre era true)

Aço dua 3 anys mal (sempre era true)
alexm reviewed 2023-04-28 09:55:32 +00:00
@ -9,10 +9,11 @@ module.exports = Self => {
* @return {boolean} True for user with read privileges
*/
Self.hasReadRole = async(ctx, name, options) => {
const collection = await Self.findOne({where: {name}}, {
Author
Member

Aço dua 3 anys mal, el objecte estava mal ficat i mai es fea la relacio

Aço dua 3 anys mal, el objecte estava mal ficat i mai es fea la relacio
alexm requested review from jgallego 2023-04-28 09:55:38 +00:00
alexm changed title from WIP: 5488-use_checkAccessAcl to 5488-use_checkAccessAcl 2023-05-02 07:36:00 +00:00
jgallego requested changes 2023-05-05 06:45:07 +00:00
@ -48,3 +48,1 @@
const isSalesPerson = await models.VnUser.hasRole(userId, 'salesPerson', myOptions);
if (!isSalesPerson)
const canEdit = await models.ACL.checkAccessAcl(ctx, 'Client', 'updateUser', 'WRITE');
Owner

quitar codigo y crear directamente un acl

quitar codigo y crear directamente un acl
alexm marked this conversation as resolved
@ -28,3 +15,1 @@
const isRoleAdvanced = isSalesAssistant || isDeliveryBoss || isBuyer || isClaimManager;
return isRoleAdvanced;
Self.isRoleAdvanced = async ctx => {
Owner

com sols hi ha una linea, pots anar un pas mes, mira els lloc que criden a isRoleAdvanced que son un 3 o 4 y que criden al acl, així llevem una ruta de back

com sols hi ha una linea, pots anar un pas mes, mira els lloc que criden a isRoleAdvanced que son un 3 o 4 y que criden al acl, així llevem una ruta de back
alexm marked this conversation as resolved
alexm added 1 commit 2023-05-05 11:58:21 +00:00
alexm added 1 commit 2023-05-05 11:59:06 +00:00
gitea/salix/pipeline/head This commit looks good Details
6b4b8565f9
Merge branch 'dev' into 5488-use_checkAccessAcl
alexm added 2 commits 2023-05-05 12:13:45 +00:00
alexm added 1 commit 2023-05-08 08:56:11 +00:00
gitea/salix/pipeline/head This commit looks good Details
7273dd4f1e
Merge branch 'dev' into 5488-use_checkAccessAcl
alexm added 3 commits 2023-05-08 11:44:02 +00:00
alexm added 1 commit 2023-05-09 12:04:49 +00:00
alexm added 2 commits 2023-05-10 12:09:15 +00:00
alexm reviewed 2023-05-10 12:11:47 +00:00
@ -0,0 +29,4 @@
('Worker', 'forceIsSubordinate', 'READ', 'ALLOW', 'ROLE', 'hr'),
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee');
Author
Member

De aci cap a baix estan els ACLs que he tingut que donar per a que funcione tot despres de llevar els ACLs de
He intententat ficarlos lo mes precis posible per sino ho he vist clar he dixat employee
Si vegeu alguno per a canviar poseumeu pls

De aci cap a baix estan els ACLs que he tingut que donar per a que funcione tot despres de llevar els ACLs de He intententat ficarlos lo mes precis posible per sino ho he vist clar he dixat employee Si vegeu alguno per a canviar poseumeu pls
alexm requested review from jgallego 2023-05-10 12:12:08 +00:00
alexm requested review from juan 2023-05-10 12:12:21 +00:00
jgallego requested changes 2023-05-10 13:41:26 +00:00
@ -41,1 +38,3 @@
if (isHr || isSubordinate)
const forceIsSubordinate = await models.ACL.checkAccessAcl(ctx, 'Worker', 'forceIsSubordinate', 'READ');
if (forceIsSubordinate || isSubordinate)
Owner

com a sugerencia, si lleves el if i poses lo del parentesis dins del return?

com a sugerencia, si lleves el if i poses lo del parentesis dins del return?
alexm marked this conversation as resolved
@ -40,3 +38,1 @@
const canSeeExpired = roles.filter(role =>
role == 'productionBoss' || role == 'administrative'
);
const canSeeExpired = await models.ACL.checkAccessAcl(ctx, 'Agency', 'editDiscount');
Owner

açò es correcte? es diuen distint

açò es correcte? es diuen distint
alexm marked this conversation as resolved
alexm reviewed 2023-05-11 08:12:38 +00:00
@ -0,0 +41,4 @@
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'getSummary', 'READ', 'ALLOW', 'ROLE', 'employee'),
Author
Member

SalesPerson

SalesPerson
alexm marked this conversation as resolved
alexm reviewed 2023-05-11 08:12:58 +00:00
@ -0,0 +42,4 @@
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'getSummary', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'updateClaim', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
Author
Member

SalesPerson

SalesPerson
alexm marked this conversation as resolved
alexm reviewed 2023-05-11 08:20:16 +00:00
@ -0,0 +28,4 @@
('Worker', 'isTeamBoss', 'WRITE', 'ALLOW', 'ROLE', 'teamBoss'),
('Worker', 'forceIsSubordinate', 'READ', 'ALLOW', 'ROLE', 'hr'),
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee');
Author
Member

SalesPerson

SalesPerson
alexm marked this conversation as resolved
alexm added 2 commits 2023-05-15 12:14:20 +00:00
alexm requested review from jgallego 2023-05-15 12:14:48 +00:00
jgallego approved these changes 2023-05-16 14:41:08 +00:00
@ -0,0 +39,4 @@
VALUES
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
Owner

Jo en el meu he posat el exists també, no se si cal posarlo ara o esperar a que es gaste

Jo en el meu he posat el exists també, no se si cal posarlo ara o esperar a que es gaste
Author
Member

/exists sols he vist q ho gaste el model account i workerDisableExcludeds. Si no es gasta no el donaria de moment

/exists sols he vist q ho gaste el model account i workerDisableExcludeds. Si no es gasta no el donaria de moment
alexm added 1 commit 2023-05-17 11:43:29 +00:00
gitea/salix/pipeline/head This commit looks good Details
6ddbd8b8ea
Merge branch 'dev' into 5488-use_checkAccessAcl
alexm added 1 commit 2023-05-18 06:10:20 +00:00
alexm added 2 commits 2023-05-23 06:24:04 +00:00
alexm added 1 commit 2023-05-24 05:40:15 +00:00
gitea/salix/pipeline/head This commit looks good Details
6a6d28efa0
Merge branch 'dev' into 5488-use_checkAccessAcl
alexm added 1 commit 2023-05-26 05:41:57 +00:00
juan approved these changes 2023-05-26 06:17:14 +00:00
alexm added 1 commit 2023-05-26 12:04:10 +00:00
gitea/salix/pipeline/head This commit looks good Details
f37d93b469
refs #5488 correct folder
alexm requested review from jgallego 2023-05-26 12:05:47 +00:00
jgallego approved these changes 2023-05-27 05:41:21 +00:00
alexm added 1 commit 2023-05-29 05:09:50 +00:00
gitea/salix/pipeline/head This commit looks good Details
ffbc39ca56
Merge branch 'dev' into 5488-use_checkAccessAcl
alexm merged commit a22ae3809e into dev 2023-05-29 05:20:29 +00:00
alexm deleted branch 5488-use_checkAccessAcl 2023-05-29 05:20:29 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 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#1482
No description provided.