mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1040] Change document list style rows based on permissions model (#2085)
* Change document list style rows based on permissions model * fix test
This commit is contained in:
@@ -39,8 +39,7 @@ module.exports = {
|
||||
loader: 'tslint-loader',
|
||||
options: {
|
||||
emitErrors: true,
|
||||
failOnHint: true,
|
||||
fix:true
|
||||
failOnHint: true
|
||||
},
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
|
@@ -117,7 +117,11 @@ export * from './src/events/base.event';
|
||||
export * from './src/events/base-ui.event';
|
||||
export * from './src/events/folder-created.event';
|
||||
export * from './src/events/file.event';
|
||||
export * from './src/models/index';
|
||||
|
||||
export * from './src/models/card-view-textitem.model';
|
||||
export * from './src/models/card-view-dateitem.model';
|
||||
export * from './src/models/file.model';
|
||||
export * from './src/models/permissions.enum';
|
||||
|
||||
export * from './src/models/index';
|
||||
|
||||
|
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16">
|
||||
<path fill="#000" fill-opacity=".28" fill-rule="evenodd" d="M8 0H2C.9 0 0 .9 0 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2h-8L8 0z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 239 B |
@@ -15,6 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './card-view-textitem.model';
|
||||
export * from './card-view-dateitem.model';
|
||||
export * from './file.model';
|
||||
export class PermissionsEnum extends String {
|
||||
static DELETE: string = 'delete';
|
||||
static UPDATE: string = 'update';
|
||||
static CREATE: string = 'create';
|
||||
static UPDATEPERMISSIONS: string = 'updatePermissions';
|
||||
static NOT_DELETE: string = '!delete';
|
||||
static NOT_UPDATE: string = '!update';
|
||||
static NOT_CREATE: string = '!create';
|
||||
static NOT_UPDATEPERMISSIONS: string = '!updatePermissions';
|
||||
}
|
@@ -44,8 +44,7 @@ describe('AlfrescoContentService', () => {
|
||||
imports: [
|
||||
AppConfigModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
declarations: [],
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AlfrescoContentService,
|
||||
@@ -53,7 +52,7 @@ describe('AlfrescoContentService', () => {
|
||||
AlfrescoSettingsService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
{provide: CookieService, useClass: CookieServiceMock},
|
||||
LogService
|
||||
]
|
||||
}).compileComponents();
|
||||
@@ -111,4 +110,20 @@ describe('AlfrescoContentService', () => {
|
||||
responseText: JSON.stringify({'entry': {'id': 'fake-post-ticket', 'userId': 'admin'}})
|
||||
});
|
||||
});
|
||||
|
||||
it('should havePermission should 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', () => {
|
||||
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', () => {
|
||||
let permissionNode = {allowableOperations: ['delete', 'update', 'updatePermissions']};
|
||||
expect(contentService.hasPermission(permissionNode, 'create')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
@@ -18,6 +18,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
import { FolderCreatedEvent } from '../events/folder-created.event';
|
||||
import { PermissionsEnum } from '../models/permissions.enum';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { LogService } from './log.service';
|
||||
@@ -71,6 +72,7 @@ export class AlfrescoContentService {
|
||||
return dataContent;
|
||||
})).catch(this.handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a folder
|
||||
* @param name - the folder name
|
||||
|
@@ -50,7 +50,8 @@ export class ThumbnailService {
|
||||
'application/vnd.apple.keynote': require('../assets/images/ft_ic_presentation.svg'),
|
||||
'application/vnd.apple.pages': require('../assets/images/ft_ic_document.svg'),
|
||||
'application/vnd.apple.numbers': require('../assets/images/ft_ic_spreadsheet.svg'),
|
||||
'folder': require('../assets/images/ft_ic_folder.svg')
|
||||
'folder': require('../assets/images/ft_ic_folder.svg'),
|
||||
'disable/folder': require('../assets/images/ft_ic_folder_disable.svg')
|
||||
};
|
||||
|
||||
constructor(public contentService: AlfrescoContentService) {
|
||||
|
Reference in New Issue
Block a user