feat; refs #5919 WIP acls

This commit is contained in:
Jorge Penadés 2024-05-08 11:03:18 +02:00
parent d0c9e83504
commit 26ff5e8fa9
3 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,7 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES ('Locker', '__get__codes', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Locker', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('Locker', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'),
('Worker', '__get__locker', 'READ', 'ALLOW', 'ROLE', 'hr'),
('Worker', '__get__locker', 'READ', 'ALLOW', 'ROLE', 'productionBoss'),
('Worker', '__get__locker', 'READ', 'ALLOW', 'ROLE', 'productionBoss');

View File

@ -1,7 +1,7 @@
{
"name": "Locker",
"base": "VnModel",
"description": "Employee's locker",
"description": "Worker's locker",
"options": {
"mysql": {
"table": "locker"
@ -14,5 +14,17 @@
"gender": {
"type": "string"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "workerFk"
}
},
"scopes": {
"codes": {
"fields": ["id","code"]
}
}
}

View File

@ -97,5 +97,23 @@
"model": "Locker",
"foreignKey": "workerFk"
}
}
},
"scopes":{
"locker": {
"fields":["id","sex"],
"include": {
"relation": "locker",
"scope": {"fields": ["id", "code"]}
}
}
},
"acls":[
{
"property": "__get__locker",
"accessType": "READ",
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "$owner"
}
]
}