refs #5518 sections added
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-04-14 14:16:29 +02:00
parent 736d0375f6
commit ad3836552e
11 changed files with 144 additions and 6 deletions

View File

@ -128,6 +128,9 @@
"UserLog": {
"dataSource": "vn"
},
"RoleLog": {
"dataSource": "vn"
},
"Warehouse": {
"dataSource": "vn"
},

58
back/models/role-log.json Normal file
View File

@ -0,0 +1,58 @@
{
"name": "RoleLog",
"base": "VnModel",
"options": {
"mysql": {
"table": "account.roleLog"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"forceId": false
},
"originFk": {
"type": "number",
"required": true
},
"userFk": {
"type": "number"
},
"action": {
"type": "string",
"required": true
},
"changedModel": {
"type": "string"
},
"oldInstance": {
"type": "object"
},
"newInstance": {
"type": "object"
},
"creationDate": {
"type": "date"
},
"changedModelId": {
"type": "number"
},
"changedModelValue": {
"type": "string"
},
"description": {
"type": "string"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
},
"scope": {
"order": ["creationDate DESC", "id DESC"]
}
}

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "userLog"
"table": "account.userLog"
}
},
"properties": {

View File

@ -0,0 +1,44 @@
DROP TABLE IF EXISTS `vn`.`userLog`;
CREATE TABLE `account`.`userLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(10) unsigned DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8mb4_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `account`.`roleLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(10) unsigned DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8mb3_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `roleLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `roleLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('UserLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
('RoleLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -19,3 +19,5 @@ import './ldap';
import './samba';
import './accounts';
import './privileges';
import './user-log';
import './role-log';

View File

@ -9,3 +9,4 @@ Mail aliases: Alias de correo
Account not enabled: Cuenta no habilitada
Inherited roles: Roles heredados
Go to the user: Ir al usuario
Log: Histórico

View File

@ -0,0 +1 @@
<vn-log url="RoleLogs" origin-id="$ctrl.$params.id"></vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnRoleLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -20,12 +20,14 @@
{"state": "account.card.roles", "icon": "group"},
{"state": "account.card.mailForwarding", "icon": "forward"},
{"state": "account.card.aliases", "icon": "email"},
{"state": "account.card.privileges", "icon": "badge"}
{"state": "account.card.privileges", "icon": "badge"},
{"state": "account.card.log", "icon": "history"}
],
"role": [
{"state": "account.role.card.basicData", "icon": "settings"},
{"state": "account.role.card.subroles", "icon": "groups"},
{"state": "account.role.card.inherited", "icon": "account_tree"}
{"state": "account.role.card.inherited", "icon": "account_tree"},
{"state": "account.role.card.log", "icon": "history"}
],
"alias": [
{"state": "account.alias.card.basicData", "icon": "settings"},
@ -80,6 +82,18 @@
"description": "Basic data",
"acl": ["hr"]
},
{
"url" : "/log",
"state": "account.card.log",
"component": "vn-user-log",
"description": "Log"
},
{
"url" : "/log",
"state": "account.role.card.log",
"component": "vn-role-log",
"description": "Log"
},
{
"url": "/roles",
"state": "account.card.roles",

View File

@ -0,0 +1 @@
<vn-log url="UserLogs" origin-id="$ctrl.$params.id"></vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnUserLog', {
template: require('./index.html'),
controller: Section,
});