style permissions fix and add in hasPermission possibility to check t… (#2113)

* style permissions fix and add in hasPermission possibility to check the negate permission
* remove fdescribe in discovery test and add test for negate permissions
This commit is contained in:
Eugenio Romano
2017-07-22 16:01:08 +01:00
parent 03f60d910f
commit d573f32640
8 changed files with 37 additions and 20 deletions

View File

@@ -111,19 +111,29 @@ describe('AlfrescoContentService', () => {
});
});
it('should havePermission should be false if allowableOperation is not present in the node', () => {
it('should havePermission be false if allowableOperation is not present in the node', () => {
let permissionNode = {};
expect(contentService.hasPermission(permissionNode, 'create')).toBeFalsy();
});
it('should havePermission should be true if allowableOperation is present and you have the permission for the request operation', () => {
it('should havePermission be true if allowableOperation is present and you have the permission for the request operation', () => {
let permissionNode = {allowableOperations: ['delete', 'update', 'create', 'updatePermissions']};
expect(contentService.hasPermission(permissionNode, 'create')).toBeTruthy();
});
it('should havePermission should be false if allowableOperation is present but you don\'t have the permission for the request operation', () => {
it('should havePermission be false if allowableOperation is present but you don\'t have the permission for the request operation', () => {
let permissionNode = {allowableOperations: ['delete', 'update', 'updatePermissions']};
expect(contentService.hasPermission(permissionNode, 'create')).toBeFalsy();
});
it('should havePermission works in the opposite way with negate value', () => {
let permissionNode = {allowableOperations: ['delete', 'update', 'updatePermissions']};
expect(contentService.hasPermission(permissionNode, '!create')).toBeTruthy();
});
it('should havePermission return false id no permission parameter are passed', () => {
let permissionNode = {allowableOperations: ['delete', 'update', 'updatePermissions']};
expect(contentService.hasPermission(permissionNode, null)).toBeFalsy();
});
});

View File

@@ -90,7 +90,7 @@ let fakeBPMDiscoveryResponse: any = {
'minorVersion': '6'
};
fdescribe('Discovery Api Service', () => {
describe('Discovery Api Service', () => {
let service;