3368-export_database #806

Merged
carlosjr merged 12 commits from 3368-export_database into dev 2021-11-25 10:53:22 +00:00
13 changed files with 1284 additions and 964 deletions

View File

@ -1,6 +1,7 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('newCollection()', () => { // #3400 analizar que hacer con rutas de back colletion
xdescribe('newCollection()', () => {
it('return a new collection', async() => { it('return a new collection', async() => {
let ctx = {req: {accessToken: {userId: 1106}}}; let ctx = {req: {accessToken: {userId: 1106}}};
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1); let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);

View File

@ -0,0 +1,27 @@
INSERT INTO `salix`.`ACL`
(model, property, accessType, permission, principalType, principalId)
VALUES
('EntryObservation', '*', '*', 'ALLOW', 'ROLE', 'buyer'),
('LdapConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin'),
('SambaConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin'),
('ACL', '*', '*', 'ALLOW', 'ROLE', 'developer'),
('AccessToken', '*', '*', 'ALLOW', 'ROLE', 'developer'),
('MailAliasAccount', '*', '*', 'ALLOW', 'ROLE', 'marketing'),
('MailAliasAccount', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('MailAlias', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('MailForward', '*', '*', 'ALLOW', 'ROLE', 'marketing'),
('MailForward', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('RoleInherit', '*', '*', 'ALLOW', 'ROLE', 'it'),
('RoleRole', '*', '*', 'ALLOW', 'ROLE', 'it'),
('AccountConfig', '*', '*', 'ALLOW', 'ROLE', 'sysadmin');
UPDATE `salix`.`ACL`
SET accessType='*', principalId='it'
WHERE model = 'Role';
DELETE FROM `salix`.`ACL`
WHERE id IN (280, 281);
UPDATE `salix`.`ACL`
SET accessType='*', principalId='marketing'
WHERE id=279;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@ TABLES=(
ACL ACL
fieldAcl fieldAcl
module module
defaultViewConfig
) )
dump_tables ${TABLES[@]} dump_tables ${TABLES[@]}

View File

@ -8,7 +8,7 @@ describe('Entry observations path', () => {
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('developer', 'entry'); await page.loginAndModule('buyer', 'entry');
await page.accessToSearchResult('2'); await page.accessToSearchResult('2');
await page.accessToSection('entry.card.observation'); await page.accessToSection('entry.card.observation');
}); });

View File

@ -59,13 +59,12 @@ describe('Account create and basic data path', () => {
await page.accessToSection('account.card.roles'); await page.accessToSection('account.card.roles');
const rolesCount = await page.countElement(selectors.accountRoles.anyResult); const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
expect(rolesCount).toEqual(4); expect(rolesCount).toEqual(3);
}); });
describe('Descriptor option', () => { describe('Descriptor option', () => {
describe('Edit role', () => { describe('Edit role', () => {
it('should edit the role using the descriptor menu', async() => { it('should edit the role using the descriptor menu', async() => {
await page.waitForTimeout(1000); // sometimes descriptor fails to load it's functionalities without this timeout
await page.waitToClick(selectors.accountDescriptor.menuButton); await page.waitToClick(selectors.accountDescriptor.menuButton);
await page.waitToClick(selectors.accountDescriptor.changeRole); await page.waitToClick(selectors.accountDescriptor.changeRole);
await page.autocompleteSearch(selectors.accountDescriptor.newRole, 'adminBoss'); await page.autocompleteSearch(selectors.accountDescriptor.newRole, 'adminBoss');
@ -76,7 +75,7 @@ describe('Account create and basic data path', () => {
}); });
it('should reload the roles section to see now there are more roles', async() => { it('should reload the roles section to see now there are more roles', async() => {
// when role updated the db takes a while to return the changes, without this timeout the result would have been 4 // when role updates db takes time to return changes, without this timeout the result would have been 3
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
await page.reloadSection('account.card.roles'); await page.reloadSection('account.card.roles');
const rolesCount = await page.countElement(selectors.accountRoles.anyResult); const rolesCount = await page.countElement(selectors.accountRoles.anyResult);

View File

@ -8,7 +8,7 @@ describe('Account Role create and basic data path', () => {
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('developer', 'account'); await page.loginAndModule('it', 'account');
await page.accessToSection('account.role'); await page.accessToSection('account.role');
}); });
@ -76,11 +76,11 @@ describe('Account Role create and basic data path', () => {
expect(subrolesCount).toEqual(1); expect(subrolesCount).toEqual(1);
}); });
it('should search for the employee role group then access to the roles inheritance section then check the roles listed are the expected ones', async() => { it('should access the employee roles inheritance then check the roles listed are the expected ones', async() => {
await page.accessToSearchResult('employee'); await page.accessToSearchResult('employee');
await page.accessToSection('account.role.card.inherited'); await page.accessToSection('account.role.card.inherited');
const rolesCount = await page.countElement(selectors.accountRoleInheritance.anyResult); const rolesCount = await page.countElement(selectors.accountRoleInheritance.anyResult);
expect(rolesCount).toEqual(7); expect(rolesCount).toEqual(6);
}); });
}); });

View File

@ -29,5 +29,11 @@
"foreignKey": "mailAlias", "foreignKey": "mailAlias",
"property": "id" "property": "id"
} }
} },
"acls": [{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}]
} }

View File

@ -5,14 +5,16 @@
<vn-item <vn-item
ng-click="deleteUser.show()" ng-click="deleteUser.show()"
name="deleteUser" name="deleteUser"
vn-acl="developer" vn-acl="it"
vn-acl-action="remove"
translate> translate>
Delete Delete
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="$ctrl.onChangeRole()" ng-click="$ctrl.onChangeRole()"
name="changeRole" name="changeRole"
vn-acl="developer" vn-acl="hr"
vn-acl-action="remove"
translate> translate>
Change role Change role
</vn-item> </vn-item>
@ -20,13 +22,16 @@
ng-if="::$root.user.id == $ctrl.id" ng-if="::$root.user.id == $ctrl.id"
ng-click="$ctrl.onChangePassClick(true)" ng-click="$ctrl.onChangePassClick(true)"
name="changePassword" name="changePassword"
vn-acl="hr"
vn-acl-action="remove"
translate> translate>
Change password Change password
</vn-item> </vn-item>
<vn-item <vn-item
ng-click="$ctrl.onChangePassClick(false)" ng-click="$ctrl.onChangePassClick(false)"
name="setPassword" name="setPassword"
vn-acl="developer" vn-acl="hr"
vn-acl-action="remove"
translate> translate>
Set password Set password
</vn-item> </vn-item>
@ -34,7 +39,8 @@
ng-if="!$ctrl.hasAccount" ng-if="!$ctrl.hasAccount"
ng-click="enableAccount.show()" ng-click="enableAccount.show()"
name="enableAccount" name="enableAccount"
vn-acl="developer" vn-acl="it"
vn-acl-action="remove"
translate> translate>
Enable account Enable account
</vn-item> </vn-item>
@ -42,7 +48,8 @@
ng-if="$ctrl.hasAccount" ng-if="$ctrl.hasAccount"
ng-click="disableAccount.show()" ng-click="disableAccount.show()"
name="disableAccount" name="disableAccount"
vn-acl="developer" vn-acl="it"
vn-acl-action="remove"
translate> translate>
Disable account Disable account
</vn-item> </vn-item>
@ -50,7 +57,8 @@
ng-if="!$ctrl.user.active" ng-if="!$ctrl.user.active"
ng-click="activateUser.show()" ng-click="activateUser.show()"
name="activateUser" name="activateUser"
vn-acl="developer" vn-acl="hr"
vn-acl-action="remove"
translate> translate>
Activate user Activate user
</vn-item> </vn-item>
@ -58,7 +66,8 @@
ng-if="$ctrl.user.active" ng-if="$ctrl.user.active"
ng-click="deactivateUser.show()" ng-click="deactivateUser.show()"
name="deactivateUser" name="deactivateUser"
vn-acl="developer" vn-acl="hr"
vn-acl-action="remove"
translate> translate>
Deactivate user Deactivate user
</vn-item> </vn-item>

View File

@ -36,9 +36,12 @@
<vn-popup vn-id="summary"> <vn-popup vn-id="summary">
<vn-user-summary user="$ctrl.selectedUser"></vn-user-summary> <vn-user-summary user="$ctrl.selectedUser"></vn-user-summary>
</vn-popup> </vn-popup>
<a ui-sref="account.create" <a
fixed-bottom-right
ui-sref="account.create"
vn-tooltip="New user" vn-tooltip="New user"
vn-bind="+" vn-bind="+"
fixed-bottom-right> vn-acl="it"
vn-acl-action="remove">
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>
</a> </a>

View File

@ -35,7 +35,7 @@
ui-sref-opts="{inherit: false}" ui-sref-opts="{inherit: false}"
vn-tooltip="New role" vn-tooltip="New role"
vn-bind="+" vn-bind="+"
vn-acl="developer" vn-acl="it"
vn-acl-action="remove" vn-acl-action="remove"
fixed-bottom-right> fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>

View File

@ -41,24 +41,29 @@
"component": "vn-user", "component": "vn-user",
"description": "Users", "description": "Users",
"abstract": true "abstract": true
}, { },
{
"url": "/index?q", "url": "/index?q",
"state": "account.index", "state": "account.index",
"component": "vn-user-index", "component": "vn-user-index",
"description": "Users", "description": "Users",
"acl": ["hr"] "acl": ["marketing", "hr"]
}, { },
{
"url": "/create", "url": "/create",
"state": "account.create", "state": "account.create",
"component": "vn-user-create", "component": "vn-user-create",
"description": "New user" "description": "New user",
}, { "acl": ["it"]
},
{
"url": "/:id", "url": "/:id",
"state": "account.card", "state": "account.card",
"component": "vn-user-card", "component": "vn-user-card",
"abstract": true, "abstract": true,
"description": "Detail" "description": "Detail"
}, { },
{
"url": "/summary", "url": "/summary",
"state": "account.card.summary", "state": "account.card.summary",
"component": "vn-user-summary", "component": "vn-user-summary",
@ -66,88 +71,110 @@
"params": { "params": {
"user": "$ctrl.user" "user": "$ctrl.user"
} }
}, { },
{
"url": "/basic-data", "url": "/basic-data",
"state": "account.card.basicData", "state": "account.card.basicData",
"component": "vn-user-basic-data", "component": "vn-user-basic-data",
"description": "Basic data" "description": "Basic data",
}, { "acl": ["hr"]
},
{
"url": "/roles", "url": "/roles",
"state": "account.card.roles", "state": "account.card.roles",
"component": "vn-user-roles", "component": "vn-user-roles",
"description": "Inherited roles" "description": "Inherited roles",
}, { "acl": ["it"]
},
{
"url": "/mail-forwarding", "url": "/mail-forwarding",
"state": "account.card.mailForwarding", "state": "account.card.mailForwarding",
"component": "vn-user-mail-forwarding", "component": "vn-user-mail-forwarding",
"description": "Mail forwarding" "description": "Mail forwarding"
}, { },
{
"url": "/aliases", "url": "/aliases",
"state": "account.card.aliases", "state": "account.card.aliases",
"component": "vn-user-aliases", "component": "vn-user-aliases",
"description": "Mail aliases" "description": "Mail aliases",
}, { "acl": ["marketing", "hr"]
},
{
"url": "/role?q", "url": "/role?q",
"state": "account.role", "state": "account.role",
"component": "vn-role", "component": "vn-role",
"description": "Roles" "description": "Roles",
}, { "acl": ["it"]
},
{
"url": "/create", "url": "/create",
"state": "account.role.create", "state": "account.role.create",
"component": "vn-role-create", "component": "vn-role-create",
"description": "New role" "description": "New role",
}, { "acl": ["it"]
},
{
"url": "/:id", "url": "/:id",
"state": "account.role.card", "state": "account.role.card",
"component": "vn-role-card", "component": "vn-role-card",
"abstract": true, "abstract": true,
"description": "Detail" "description": "Detail"
}, { },
{
"url": "/summary", "url": "/summary",
"state": "account.role.card.summary", "state": "account.role.card.summary",
"component": "vn-role-summary", "component": "vn-role-summary",
"description": "Summary", "description": "Summary",
"params": { "params": {
"role": "$ctrl.role" "role": "$ctrl.role"
} },
}, { "acl": ["it"]
},
{
"url": "/basic-data", "url": "/basic-data",
"state": "account.role.card.basicData", "state": "account.role.card.basicData",
"component": "vn-role-basic-data", "component": "vn-role-basic-data",
"description": "Basic data", "description": "Basic data",
"acl": ["developer"],
"params": { "params": {
"role": "$ctrl.role" "role": "$ctrl.role"
} },
}, { "acl": ["it"]
},
{
"url": "/subroles", "url": "/subroles",
"state": "account.role.card.subroles", "state": "account.role.card.subroles",
"component": "vn-role-subroles", "component": "vn-role-subroles",
"acl": ["developer"], "description": "Subroles",
"description": "Subroles" "acl": ["it"]
}, { },
{
"url": "/inherited", "url": "/inherited",
"state": "account.role.card.inherited", "state": "account.role.card.inherited",
"component": "vn-role-inherited", "component": "vn-role-inherited",
"description": "Inherited roles" "description": "Inherited roles",
}, { "acl": ["it"]
},
{
"url": "/alias?q", "url": "/alias?q",
"state": "account.alias", "state": "account.alias",
"component": "vn-alias", "component": "vn-alias",
"description": "Mail aliases", "description": "Mail aliases",
"acl": ["developer"] "acl": ["marketing"]
}, { },
{
"url": "/create", "url": "/create",
"state": "account.alias.create", "state": "account.alias.create",
"component": "vn-alias-create", "component": "vn-alias-create",
"description": "New alias" "description": "New alias"
}, { },
{
"url": "/:id", "url": "/:id",
"state": "account.alias.card", "state": "account.alias.card",
"component": "vn-alias-card", "component": "vn-alias-card",
"abstract": true, "abstract": true,
"description": "Detail" "description": "Detail"
}, { },
{
"url": "/summary", "url": "/summary",
"state": "account.alias.card.summary", "state": "account.alias.card.summary",
"component": "vn-alias-summary", "component": "vn-alias-summary",
@ -155,7 +182,8 @@
"params": { "params": {
"alias": "$ctrl.alias" "alias": "$ctrl.alias"
} }
}, { },
{
"url": "/basic-data", "url": "/basic-data",
"state": "account.alias.card.basicData", "state": "account.alias.card.basicData",
"component": "vn-alias-basic-data", "component": "vn-alias-basic-data",
@ -163,50 +191,62 @@
"params": { "params": {
"alias": "$ctrl.alias" "alias": "$ctrl.alias"
} }
}, { },
{
"url": "/users", "url": "/users",
"state": "account.alias.card.users", "state": "account.alias.card.users",
"component": "vn-alias-users", "component": "vn-alias-users",
"description": "Users" "description": "Users",
}, { "acl": ["it"]
},
{
"url": "/accounts", "url": "/accounts",
"state": "account.accounts", "state": "account.accounts",
"component": "vn-account-accounts", "component": "vn-account-accounts",
"description": "Accounts", "description": "Accounts",
"acl": ["developer"] "acl": ["sysadmin"]
}, { },
{
"url": "/ldap", "url": "/ldap",
"state": "account.ldap", "state": "account.ldap",
"component": "vn-account-ldap", "component": "vn-account-ldap",
"description": "LDAP", "description": "LDAP",
"acl": ["developer"] "acl": ["sysadmin"]
}, { },
{
"url": "/samba", "url": "/samba",
"state": "account.samba", "state": "account.samba",
"component": "vn-account-samba", "component": "vn-account-samba",
"description": "Samba", "description": "Samba",
"acl": ["developer"] "acl": ["sysadmin"]
}, { },
{
"url": "/acl?q", "url": "/acl?q",
"state": "account.acl", "state": "account.acl",
"component": "vn-acl-component", "component": "vn-acl-component",
"description": "ACLs", "description": "ACLs",
"acl": ["developer"] "acl": ["developer"]
}, { },
{
"url": "/create", "url": "/create",
"state": "account.acl.create", "state": "account.acl.create",
"component": "vn-acl-create", "component": "vn-acl-create",
"description": "New ACL" "description": "New ACL",
}, { "acl": ["developer"]
},
{
"url": "/:id/edit", "url": "/:id/edit",
"state": "account.acl.edit", "state": "account.acl.edit",
"component": "vn-acl-create", "component": "vn-acl-create",
"description": "Edit ACL" "description": "Edit ACL",
}, { "acl": ["developer"]
},
{
"url": "/connections", "url": "/connections",
"state": "account.connections", "state": "account.connections",
"component": "vn-connections", "component": "vn-connections",
"description": "Connections" "description": "Connections",
"acl": ["developer"]
} }
] ]
} }