conditional Deleted By column (#435)

This commit is contained in:
Cilibiu Bogdan
2018-06-19 12:10:21 +03:00
committed by Denys Vuika
parent bf3c86f5f5
commit ec2323b038
3 changed files with 17 additions and 4 deletions

View File

@@ -87,6 +87,7 @@
</data-column>
<data-column
*ngIf="userIsAdmin"
class="adf-data-table-cell--ellipsis"
key="archivedByUser.displayName"
title="APP.DOCUMENT_LIST.COLUMNS.DELETED_BY">

View File

@@ -32,7 +32,7 @@ import {
UserPreferencesService, LogService, AppConfigService,
StorageService, CookieService, ThumbnailService,
AuthenticationService, TimeAgoPipe, NodeNameTooltipPipe,
NodeFavoriteDirective, DataTableComponent, AppConfigPipe
NodeFavoriteDirective, DataTableComponent, AppConfigPipe, PeopleContentService
} from '@alfresco/adf-core';
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
import { TranslateModule } from '@ngx-translate/core';
@@ -86,6 +86,7 @@ describe('TrashcanComponent', () => {
{ provide: TranslationService, useClass: TranslationMock },
AuthenticationService,
UserPreferencesService,
PeopleContentService,
AppConfigService, StorageService, CookieService,
AlfrescoApiService,
LogService,

View File

@@ -26,7 +26,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Pagination } from 'alfresco-js-api';
import { UserPreferencesService } from '@alfresco/adf-core';
import { UserPreferencesService, PeopleContentService } from '@alfresco/adf-core';
import { ContentManagementService } from '../../common/services/content-management.service';
import { PageComponent } from '../page.component';
import { Store } from '@ngrx/store';
@@ -36,8 +36,10 @@ import { AppStore } from '../../store/states/app.state';
templateUrl: './trashcan.component.html'
})
export class TrashcanComponent extends PageComponent implements OnInit {
userIsAdmin: boolean;
constructor(private contentManagementService: ContentManagementService,
private peopleApi: PeopleContentService,
preferences: UserPreferencesService,
store: Store<AppStore>,
route: ActivatedRoute) {
@@ -50,11 +52,20 @@ export class TrashcanComponent extends PageComponent implements OnInit {
this.subscriptions.push(
this.contentManagementService.nodesRestored.subscribe(() => this.reload()),
this.contentManagementService.nodesPurged.subscribe(() => this.reload()),
this.contentManagementService.nodesRestored.subscribe(() => this.reload())
this.contentManagementService.nodesRestored.subscribe(() => this.reload()),
this.peopleApi.getCurrentPerson().subscribe((user: any) => this.isUserAdmin(user))
);
}
onChangePageSize(event: Pagination): void {
this.preferences.paginationSize = event.maxItems;
}
}
private isUserAdmin(user) {
if (user && user.capabilities) {
this.userIsAdmin = user.capabilities.isAdmin;
} else {
this.userIsAdmin = true;
}
}
}