mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACA-2302] upgrade to ADF 3.2.0 beta (#1049)
* upgrade to ADF 3.2.0 beta 2 * remove deprecated extension classes * fix some DL style issues * update class names * update cell classes * update viewer * fix test * update angular dependencies * cleanup login component * update tests * fix selector * fix document list cell selector * fix viewer extension test * upgrade to beta3 * fix some tests and disable tests until regression is fixed on ADF side * disable hyperlink e2e for now * upgrade to latest alpha * restore tests
This commit is contained in:
@@ -32,8 +32,8 @@ import { GenericErrorComponent } from './components/common/generic-error/generic
|
||||
import { SearchResultsComponent } from './components/search/search-results/search-results.component';
|
||||
import { SearchLibrariesResultsComponent } from './components/search/search-libraries-results/search-libraries-results.component';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import { AppAuthGuard } from './guards/auth.guard';
|
||||
import { AppSharedRuleGuard } from './guards/shared.guard';
|
||||
import { AuthGuardEcm } from '@alfresco/adf-core';
|
||||
|
||||
export const APP_ROUTES: Routes = [
|
||||
{
|
||||
@@ -242,7 +242,7 @@ export const APP_ROUTES: Routes = [
|
||||
component: GenericErrorComponent
|
||||
}
|
||||
],
|
||||
canActivateChild: [AppAuthGuard],
|
||||
canActivate: [AppAuthGuard]
|
||||
canActivateChild: [AuthGuardEcm],
|
||||
canActivate: [AuthGuardEcm]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -100,7 +100,7 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private getTarget(event: MouseEvent): Element {
|
||||
return this.findAncestor(<Element>event.target, 'adf-datatable-table-cell');
|
||||
return this.findAncestor(<Element>event.target, 'adf-datatable-cell');
|
||||
}
|
||||
|
||||
private isSelected(target): boolean {
|
||||
|
||||
@@ -45,8 +45,7 @@ describe('ContextActionsDirective', () => {
|
||||
|
||||
it('should call service to render context menu', fakeAsync(() => {
|
||||
const el = document.createElement('div');
|
||||
el.className =
|
||||
'adf-data-table-cell adf-datatable-table-cell adf-datatable-row';
|
||||
el.className = 'adf-data-table-cell adf-datatable-cell adf-datatable-row';
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
fragment.appendChild(el);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
[copyrightText]="'application.copyright' | adfAppConfig | translate"
|
||||
providers="ECM"
|
||||
successRoute="/personal-files"
|
||||
[logoImageUrl]="'./assets/images/alfresco-logo.svg'"
|
||||
logoImageUrl="./assets/images/alfresco-logo.svg"
|
||||
[showRememberMe]="false"
|
||||
[showLoginActions]="false"
|
||||
>
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Location } from '@angular/common';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import {
|
||||
AuthenticationService,
|
||||
UserPreferencesService,
|
||||
AppConfigPipe
|
||||
} from '@alfresco/adf-core';
|
||||
import { LoginComponent } from './login.component';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
|
||||
describe('LoginComponent', () => {
|
||||
let fixture: ComponentFixture<LoginComponent>;
|
||||
let router: Router;
|
||||
let userPreference: UserPreferencesService;
|
||||
let auth: AuthenticationService;
|
||||
let location: Location;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
declarations: [LoginComponent, AppConfigPipe],
|
||||
providers: [Location],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
|
||||
router = TestBed.get(Router);
|
||||
spyOn(router, 'navigateByUrl');
|
||||
|
||||
location = TestBed.get(Location);
|
||||
spyOn(location, 'forward');
|
||||
|
||||
auth = TestBed.get(AuthenticationService);
|
||||
spyOn(auth, 'getRedirect').and.returnValue('/some-url');
|
||||
|
||||
userPreference = TestBed.get(UserPreferencesService);
|
||||
spyOn(userPreference, 'setStoragePrefix');
|
||||
});
|
||||
|
||||
describe('OnInit()', () => {
|
||||
it('should perform normal login when user is not logged in', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(location.forward).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should redirect when user is logged in', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(true);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(location.forward).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -23,29 +23,9 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
templateUrl: './login.component.html'
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
constructor(
|
||||
private location: Location,
|
||||
private auth: AuthenticationService,
|
||||
private route: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.auth.isEcmLoggedIn()) {
|
||||
this.location.forward();
|
||||
} else {
|
||||
this.route.queryParams.subscribe((params: Params) => {
|
||||
const redirectUrl = params['redirectUrl'];
|
||||
this.auth.setRedirect({ provider: 'ECM', url: redirectUrl });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
export class LoginComponent {}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
flex: 1;
|
||||
|
||||
.adf-datatable-permission {
|
||||
.adf-data-table-cell--icon {
|
||||
.adf-datatable-cell--icon {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,20 +31,5 @@
|
||||
<aca-toolbar-action [actionRef]="action"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-viewer-toolbar-actions>
|
||||
|
||||
<ng-container *ngFor="let ext of contentExtensions">
|
||||
<adf-viewer-extension [supportedExtensions]="[ext.fileExtension]">
|
||||
<ng-template let-url="urlFileContent" let-extension="extension">
|
||||
<app-preview-extension
|
||||
[id]="ext.component"
|
||||
[node]="selection.file?.entry"
|
||||
[url]="url"
|
||||
[extension]="extension"
|
||||
[attr.data-automation-id]="ext.component"
|
||||
>
|
||||
</app-preview-extension>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
</ng-container>
|
||||
</adf-viewer>
|
||||
</ng-container>
|
||||
|
||||
@@ -149,7 +149,6 @@ export class PreviewComponent extends PageComponent
|
||||
]);
|
||||
|
||||
this.openWith = this.extensions.openWithActions;
|
||||
this.contentExtensions = this.extensions.viewerContentExtensions;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
<data-column
|
||||
*ngIf="!isSmallScreen && (user$ | async)?.isAdmin"
|
||||
class="adf-data-table-cell--ellipsis"
|
||||
class="adf-ellipsis-cell adf-expand-cell-5"
|
||||
key="archivedByUser.displayName"
|
||||
title="APP.DOCUMENT_LIST.COLUMNS.DELETED_BY"
|
||||
>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { RuleContext } from '@alfresco/adf-extensions';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
export interface AppRuleContext extends RuleContext {
|
||||
repository: RepositoryInfo;
|
||||
auth: AuthenticationService;
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { CoreModule, AuthGuardEcm } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { AppLayoutComponent } from '../components/layout/app-layout/app-layout.component';
|
||||
@@ -40,7 +40,6 @@ import { LibraryMetadataTabComponent } from '../components/info-drawer/library-m
|
||||
import { CommentsTabComponent } from '../components/info-drawer/comments-tab/comments-tab.component';
|
||||
import { VersionsTabComponent } from '../components/info-drawer/versions-tab/versions-tab.component';
|
||||
import { ExtensionsModule, ExtensionService } from '@alfresco/adf-extensions';
|
||||
import { AppAuthGuard } from '../guards/auth.guard';
|
||||
import { LocationLinkComponent } from '../components/common/location-link/location-link.component';
|
||||
import { DocumentDisplayModeComponent } from '../components/toolbar/document-display-mode/document-display-mode.component';
|
||||
import { ToggleJoinLibraryButtonComponent } from '../components/toolbar/toggle-join-library/toggle-join-library-button.component';
|
||||
@@ -106,7 +105,7 @@ export class CoreExtensionsModule {
|
||||
});
|
||||
|
||||
extensions.setAuthGuards({
|
||||
'app.auth': AppAuthGuard
|
||||
'app.auth': AuthGuardEcm
|
||||
});
|
||||
|
||||
extensions.setEvaluators({
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ExtensionElement } from '@alfresco/adf-extensions';
|
||||
|
||||
export interface DocumentListPresetRef extends ExtensionElement {
|
||||
key: string;
|
||||
type: string; // text|image|date
|
||||
title?: string;
|
||||
format?: string;
|
||||
class?: string;
|
||||
sortable: boolean;
|
||||
template: string;
|
||||
desktopOnly: boolean;
|
||||
}
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
import { RuleContext, RuleParameter } from '@alfresco/adf-extensions';
|
||||
import { AppRuleContext } from '../app.interface';
|
||||
import {
|
||||
isNotTrashcan,
|
||||
isNotLibraries,
|
||||
@@ -375,7 +374,7 @@ export function hasLockedFiles(
|
||||
* JSON ref: `app.selection.file.isLocked`
|
||||
*/
|
||||
export function isWriteLocked(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
return !!(
|
||||
@@ -396,7 +395,7 @@ export function isWriteLocked(
|
||||
* JSON ref: `app.selection.file.isLockOwner`
|
||||
*/
|
||||
export function isUserWriteLockOwner(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
return (
|
||||
@@ -412,7 +411,7 @@ export function isUserWriteLockOwner(
|
||||
* JSON ref: `app.selection.file.canLock`
|
||||
*/
|
||||
export function canLockFile(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
return (
|
||||
@@ -425,7 +424,7 @@ export function canLockFile(
|
||||
* JSON ref: `app.selection.file.canLock`
|
||||
*/
|
||||
export function canUnlockFile(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
const { file } = context.selection;
|
||||
@@ -441,7 +440,7 @@ export function canUnlockFile(
|
||||
* JSON ref: `app.selection.file.canUploadVersion`
|
||||
*/
|
||||
export function canUploadVersion(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
if (isFavorites(context, ...args) || isSharedFiles(context, ...args)) {
|
||||
|
||||
@@ -23,15 +23,14 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { RuleParameter } from '@alfresco/adf-extensions';
|
||||
import { AppRuleContext } from '../app.interface';
|
||||
import { RuleParameter, RuleContext } from '@alfresco/adf-extensions';
|
||||
|
||||
/**
|
||||
* Checks if the quick share repository option is enabled or not.
|
||||
* JSON ref: `repository.isQuickShareEnabled`
|
||||
*/
|
||||
export function hasQuickShareEnabled(
|
||||
context: AppRuleContext,
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
return context.repository.status.isQuickShareEnabled;
|
||||
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
NavigationState,
|
||||
ExtensionConfig,
|
||||
RuleEvaluator,
|
||||
ViewerExtensionRef,
|
||||
ContentActionRef,
|
||||
ContentActionType,
|
||||
ExtensionLoaderService,
|
||||
@@ -48,19 +47,19 @@ import {
|
||||
ExtensionService,
|
||||
ProfileState,
|
||||
mergeObjects,
|
||||
ExtensionRef
|
||||
ExtensionRef,
|
||||
RuleContext,
|
||||
DocumentListPresetRef,
|
||||
IconRef
|
||||
} from '@alfresco/adf-extensions';
|
||||
import { AppConfigService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { DocumentListPresetRef } from './document-list.extensions';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { IconRef } from './icon.extensions';
|
||||
import { AppRuleContext } from './app.interface';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppExtensionService implements AppRuleContext {
|
||||
export class AppExtensionService implements RuleContext {
|
||||
private _references = new BehaviorSubject<ExtensionRef[]>([]);
|
||||
|
||||
defaults = {
|
||||
@@ -72,7 +71,6 @@ export class AppExtensionService implements AppRuleContext {
|
||||
toolbarActions: Array<ContentActionRef> = [];
|
||||
viewerToolbarActions: Array<ContentActionRef> = [];
|
||||
sharedLinkViewerToolbarActions: Array<ContentActionRef> = [];
|
||||
viewerContentExtensions: Array<ViewerExtensionRef> = [];
|
||||
contextMenuActions: Array<ContentActionRef> = [];
|
||||
openWithActions: Array<ContentActionRef> = [];
|
||||
createActions: Array<ContentActionRef> = [];
|
||||
@@ -154,10 +152,6 @@ export class AppExtensionService implements AppRuleContext {
|
||||
'features.viewer.shared.toolbarActions'
|
||||
);
|
||||
|
||||
this.viewerContentExtensions = this.loader
|
||||
.getElements<ViewerExtensionRef>(config, 'features.viewer.content')
|
||||
.filter(ref => !this.isViewerExtensionDisabled(ref));
|
||||
|
||||
this.contextMenuActions = this.loader.getContentActions(
|
||||
config,
|
||||
'features.contextMenu'
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ExtensionElement } from '@alfresco/adf-extensions';
|
||||
|
||||
export interface IconRef extends ExtensionElement {
|
||||
value: string;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppAuthGuard } from './auth.guard';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../testing/app-testing.module';
|
||||
import { AuthenticationService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
describe('AppAuthGuard', () => {
|
||||
let auth: AuthenticationService;
|
||||
let guard: AppAuthGuard;
|
||||
let router: Router;
|
||||
let config: AppConfigService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule, RouterTestingModule],
|
||||
providers: [AppAuthGuard]
|
||||
});
|
||||
|
||||
auth = TestBed.get(AuthenticationService);
|
||||
guard = TestBed.get(AppAuthGuard);
|
||||
router = TestBed.get(Router);
|
||||
config = TestBed.get(AppConfigService);
|
||||
|
||||
spyOn(router, 'navigateByUrl').and.stub();
|
||||
});
|
||||
|
||||
it('should fall through when withCredentials enabled', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(false);
|
||||
|
||||
config.config = {
|
||||
auth: {
|
||||
withCredentials: false
|
||||
}
|
||||
};
|
||||
|
||||
expect(guard.checkLogin(null)).toBe(false);
|
||||
|
||||
config.config = {
|
||||
auth: {
|
||||
withCredentials: true
|
||||
}
|
||||
};
|
||||
|
||||
expect(guard.checkLogin(null)).toBe(true);
|
||||
});
|
||||
|
||||
it('should evaluate to [true] if logged in already', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(true);
|
||||
|
||||
expect(guard.checkLogin(null)).toBe(true);
|
||||
});
|
||||
|
||||
it('should navigate to login with the redirect url', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(false);
|
||||
expect(guard.checkLogin('test/url')).toBe(false);
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(
|
||||
'/login?redirectUrl=test/url'
|
||||
);
|
||||
});
|
||||
|
||||
it('should evaluate to [false] with OAuth enabled', () => {
|
||||
spyOn(auth, 'isEcmLoggedIn').and.returnValue(false);
|
||||
spyOn(auth, 'isOauth').and.returnValue(true);
|
||||
spyOn(guard, 'isOAuthWithoutSilentLogin').and.returnValue(false);
|
||||
|
||||
expect(guard.checkLogin(null)).toBe(false);
|
||||
expect(router.navigateByUrl).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,63 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import {
|
||||
AuthenticationService,
|
||||
AppConfigService,
|
||||
AuthGuardEcm
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppAuthGuard extends AuthGuardEcm {
|
||||
constructor(
|
||||
private _auth: AuthenticationService,
|
||||
private _router: Router,
|
||||
private _config: AppConfigService
|
||||
) {
|
||||
super(_auth, _router, _config);
|
||||
}
|
||||
|
||||
checkLogin(redirectUrl: string): boolean {
|
||||
const withCredentials = this._config.get<boolean>(
|
||||
'auth.withCredentials',
|
||||
false
|
||||
);
|
||||
|
||||
if (withCredentials || this._auth.isEcmLoggedIn()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this._auth.isOauth() || this.isOAuthWithoutSilentLogin()) {
|
||||
this._auth.setRedirect({ provider: 'ECM', url: redirectUrl });
|
||||
this._router.navigateByUrl('/login?redirectUrl=' + redirectUrl);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,15 @@ import {
|
||||
AlfrescoApiService,
|
||||
ContentService,
|
||||
DataColumn,
|
||||
TranslationService
|
||||
TranslationService,
|
||||
ThumbnailService
|
||||
} from '@alfresco/adf-core';
|
||||
import {
|
||||
DocumentListService,
|
||||
ContentNodeSelectorComponent,
|
||||
ContentNodeSelectorComponentData,
|
||||
ContentNodeDialogService
|
||||
ContentNodeDialogService,
|
||||
ShareDataRow
|
||||
} from '@alfresco/adf-content-services';
|
||||
import {
|
||||
MinimalNodeEntity,
|
||||
@@ -68,7 +70,8 @@ export class NodeActionsService {
|
||||
private dialog: MatDialog,
|
||||
private documentListService: DocumentListService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private translation: TranslationService
|
||||
private translation: TranslationService,
|
||||
private thumbnailService: ThumbnailService
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -634,22 +637,17 @@ export class NodeActionsService {
|
||||
return this.contentService.hasAllowableOperations(node, permission);
|
||||
}
|
||||
|
||||
// todo: review once 1.10-beta6 is out
|
||||
private rowFilter(row: /*ShareDataRow*/ any): boolean {
|
||||
private rowFilter(row: ShareDataRow): boolean {
|
||||
const node: MinimalNodeEntryEntity = row.node.entry;
|
||||
|
||||
this.isSitesDestinationAvailable = !!node['guid'];
|
||||
return !node.isFile && node.nodeType !== 'app:folderlink';
|
||||
}
|
||||
|
||||
// todo: review once 1.10-beta6 is out
|
||||
private imageResolver(
|
||||
row: /*ShareDataRow*/ any,
|
||||
col: DataColumn
|
||||
): string | null {
|
||||
private imageResolver(row: ShareDataRow, _: DataColumn): string | null {
|
||||
const entry: MinimalNodeEntryEntity = row.node.entry;
|
||||
if (!this.contentService.hasAllowableOperations(entry, 'update')) {
|
||||
return this.documentListService.getMimeTypeIcon('disable/folder');
|
||||
return this.thumbnailService.getMimeTypeIcon('disable/folder');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,49 +1,29 @@
|
||||
@import 'mixins';
|
||||
|
||||
@mixin adf-document-list-theme($theme) {
|
||||
$foreground: map-get($theme, foreground);
|
||||
$background: map-get($theme, background);
|
||||
$primary: map-get($theme, primary);
|
||||
.adf-datatable-list {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.mat-icon.adf-datatable-selected > svg {
|
||||
fill: #2196f3;
|
||||
}
|
||||
|
||||
adf-document-list {
|
||||
@include flex-column;
|
||||
background-color: mat-color($background, card);
|
||||
}
|
||||
|
||||
adf-datatable {
|
||||
.adf-datatable {
|
||||
@include flex-column;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.adf-data-table {
|
||||
border: none !important;
|
||||
|
||||
.adf-datatable-selected > svg {
|
||||
// fill: mat-color($primary);
|
||||
fill: #2196f3;
|
||||
}
|
||||
|
||||
.adf-datatable-header,
|
||||
.adf-datatable-row,
|
||||
.adf-data-table-cell {
|
||||
color: mat-color($foreground, text, 0.54);
|
||||
.adf-datatable-cell-header,
|
||||
.adf-datatable-cell {
|
||||
&:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.adf-cell-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.adf-data-table-cell {
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.adf-datatable-table-cell-header:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.adf-datatable-body .adf-datatable-row {
|
||||
&:hover,
|
||||
&:focus {
|
||||
@@ -56,55 +36,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.adf-data-table-cell,
|
||||
.adf-datatable-header {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.adf-datatable-body .adf-data-table-cell--image {
|
||||
padding-left: 24px;
|
||||
padding-right: 0;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.adf-data-table-cell--ellipsis .adf-cell-value,
|
||||
.adf-data-table-cell--ellipsis__name .adf-cell-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.adf-data-table-cell--ellipsis .adf-datatable-cell,
|
||||
.adf-data-table-cell--ellipsis__name .adf-datatable-cell {
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.adf-data-table-cell--ellipsis .adf-datatable-cell {
|
||||
max-width: 7vw;
|
||||
}
|
||||
|
||||
.adf-data-table-cell--ellipsis__name .adf-datatable-cell {
|
||||
position: absolute;
|
||||
max-width: calc(100% - 2em);
|
||||
}
|
||||
|
||||
.adf-datatable-row:last-child .adf-datatable-table-cell {
|
||||
border-bottom: 1px solid mat-color($foreground, text, 0.07);
|
||||
}
|
||||
|
||||
&.adf-data-table--empty {
|
||||
.adf-datatable--empty {
|
||||
.adf-datatable-row {
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: unset;
|
||||
}
|
||||
|
||||
.adf-datatable-table-cell {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,7 +1296,6 @@
|
||||
"id": "app.files.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1305,7 +1304,7 @@
|
||||
"key": "name",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-ellipsis-cell adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.name",
|
||||
"desktopOnly": false
|
||||
@@ -1332,7 +1331,7 @@
|
||||
"key": "modifiedByUser.displayName",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis",
|
||||
"class": "adf-ellipsis-cell",
|
||||
"sortable": true,
|
||||
"desktopOnly": true
|
||||
}
|
||||
@@ -1342,7 +1341,6 @@
|
||||
"id": "app.libraries.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1351,7 +1349,7 @@
|
||||
"key": "title",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.libraryName",
|
||||
"desktopOnly": false
|
||||
@@ -1380,7 +1378,6 @@
|
||||
"id": "app.favorite.libraries.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1389,7 +1386,7 @@
|
||||
"key": "title",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.libraryName",
|
||||
"desktopOnly": false
|
||||
@@ -1418,7 +1415,6 @@
|
||||
"id": "app.shared.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1427,7 +1423,7 @@
|
||||
"key": "name",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.name",
|
||||
"desktopOnly": false
|
||||
@@ -1463,7 +1459,7 @@
|
||||
"key": "modifiedByUser.displayName",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis",
|
||||
"class": "adf-ellipsis-cell",
|
||||
"sortable": true,
|
||||
"desktopOnly": true
|
||||
},
|
||||
@@ -1472,7 +1468,7 @@
|
||||
"key": "sharedByUser.displayName",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis",
|
||||
"class": "adf-ellipsis-cell",
|
||||
"sortable": true,
|
||||
"desktopOnly": true
|
||||
}
|
||||
@@ -1482,7 +1478,6 @@
|
||||
"id": "app.recent.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1491,7 +1486,7 @@
|
||||
"key": "name",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.name",
|
||||
"desktopOnly": false
|
||||
@@ -1528,7 +1523,6 @@
|
||||
"id": "app.favorites.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1537,7 +1531,7 @@
|
||||
"key": "name",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.name",
|
||||
"desktopOnly": false
|
||||
@@ -1573,7 +1567,7 @@
|
||||
"key": "modifiedByUser.displayName",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis",
|
||||
"class": "adf-ellipsis-cell",
|
||||
"sortable": true,
|
||||
"desktopOnly": true
|
||||
}
|
||||
@@ -1583,7 +1577,6 @@
|
||||
"id": "app.trashcan.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1592,7 +1585,7 @@
|
||||
"key": "name",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.trashcanName",
|
||||
"desktopOnly": false
|
||||
@@ -1629,7 +1622,6 @@
|
||||
"id": "app.libraries.thumbnail",
|
||||
"key": "$thumbnail",
|
||||
"type": "image",
|
||||
"class": "adf-image-table-cell",
|
||||
"sortable": false,
|
||||
"desktopOnly": false
|
||||
},
|
||||
@@ -1638,7 +1630,7 @@
|
||||
"key": "title",
|
||||
"title": "APP.DOCUMENT_LIST.COLUMNS.NAME",
|
||||
"type": "text",
|
||||
"class": "adf-data-table-cell--ellipsis__name",
|
||||
"class": "adf-expand-cell-5",
|
||||
"sortable": true,
|
||||
"template": "app.columns.libraryName",
|
||||
"desktopOnly": false
|
||||
|
||||
Reference in New Issue
Block a user