salix/db/changes/230201/00-createWorker.sql

44 lines
1.9 KiB
MySQL
Raw Normal View History

2022-11-14 14:19:16 +00:00
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('ProfileType', '*', '*', 'ALLOW', 'ROLE', 'employee');
CREATE TABLE `vn`.`newWorkerConfig` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`street` VARCHAR(25) NULL,
`provinceFk` smallint(6) unsigned NULL,
`companyFk` smallint(5) unsigned NULL,
`profileTypeFk` INT(11) NULL,
`roleFk` int(10) unsigned NULL,
PRIMARY KEY (`id`),
CONSTRAINT `newWorkerConfig_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `newWorkerConfig_company_fk` FOREIGN KEY (`companyFk`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `newWorkerConfig_profileType_fk` FOREIGN KEY (`profileTypeFk`) REFERENCES `vn`.`profileType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `newWorkerConfig_role_fk` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
2023-01-03 13:50:29 +00:00
UPDATE `salix`.`ACL`
SET accessType='READ'
WHERE model='Worker'
AND property='*'
AND accessType='*'
AND permission='ALLOW'
AND principalType='ROLE'
AND principalId='employee';
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('Worker', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
('Worker', 'createAbsence', '*', 'ALLOW', 'ROLE', 'employee'),
2023-01-04 08:23:18 +00:00
('Worker', 'updateAbsence', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
2023-01-03 13:50:29 +00:00
('Worker', 'deleteAbsence', '*', 'ALLOW', 'ROLE', 'employee'),
('Worker', 'new', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
('Role', '*', 'READ', 'ALLOW', 'ROLE', 'hr');
/*
INSERT INTO `vn`.`newWorkerConfig` (`id`, `street`, `provinceFk`, `companyFk`, `profileTypeFk`, `roleFk`)
VALUES
(1, 'C/ ', 57, 442, 1, 1);
*/