mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
fix
This commit is contained in:
9
.github/workflows/pull-request.yml
vendored
9
.github/workflows/pull-request.yml
vendored
@@ -392,15 +392,6 @@ jobs:
|
|||||||
check-cs-env: "true"
|
check-cs-env: "true"
|
||||||
check-ps-cloud-env: "true"
|
check-ps-cloud-env: "true"
|
||||||
deps: "testing"
|
deps: "testing"
|
||||||
- description: "Process Cloud: People"
|
|
||||||
test-id: "process-services-cloud"
|
|
||||||
folder: "process-services-cloud/people"
|
|
||||||
provider: "ALL"
|
|
||||||
auth: "OAUTH"
|
|
||||||
apa-proxy: true
|
|
||||||
check-cs-env: "true"
|
|
||||||
check-ps-cloud-env: "true"
|
|
||||||
deps: "testing"
|
|
||||||
- description: "Process Cloud: Process"
|
- description: "Process Cloud: Process"
|
||||||
test-id: "process-services-cloud"
|
test-id: "process-services-cloud"
|
||||||
folder: "process-services-cloud/process"
|
folder: "process-services-cloud/process"
|
||||||
|
@@ -285,7 +285,7 @@ exports.config = {
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (browser.params.testConfig.appConfig.authType === 'OAUTH') {
|
if (browser.params.testConfig.appConfig.authType === 'OAUTH') {
|
||||||
|
Logger.info(`Configure demo shell OAUTH`);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await LocalStorageUtil.setStorageItem('identityHost', browser.params.testConfig.appConfig.identityHost);
|
await LocalStorageUtil.setStorageItem('identityHost', browser.params.testConfig.appConfig.identityHost);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@@ -20,6 +20,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { StorageService } from '../common/services/storage.service';
|
import { StorageService } from '../common/services/storage.service';
|
||||||
|
import { AuthenticationService, BasicAlfrescoAuthService } from "../auth";
|
||||||
|
|
||||||
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
|
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
|
||||||
return () => angularAlfrescoApiService.init();
|
return () => angularAlfrescoApiService.init();
|
||||||
@@ -29,10 +30,22 @@ export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApi
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AlfrescoApiLoaderService {
|
export class AlfrescoApiLoaderService {
|
||||||
constructor(private readonly appConfig: AppConfigService, private readonly apiService: AlfrescoApiService, private storageService: StorageService) {}
|
constructor(private readonly appConfig: AppConfigService,
|
||||||
|
private readonly apiService: AlfrescoApiService,
|
||||||
|
private readonly basicAlfrescoAuthService: BasicAlfrescoAuthService,
|
||||||
|
private readonly authService: AuthenticationService,
|
||||||
|
private storageService: StorageService) {
|
||||||
|
}
|
||||||
|
|
||||||
async init(): Promise<any> {
|
async init(): Promise<any> {
|
||||||
await this.appConfig.load();
|
await this.appConfig.load();
|
||||||
|
|
||||||
|
this.authService.onLogin.subscribe(async () => {
|
||||||
|
if (this.authService.isOauth() && (this.authService.isALLProvider() || this.authService.isECMProvider())) {
|
||||||
|
await this.basicAlfrescoAuthService.requireAlfTicket();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this.initAngularAlfrescoApi();
|
return this.initAngularAlfrescoApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
|||||||
|
|
||||||
this.appConfig.onLoad
|
this.appConfig.onLoad
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
if (this.isLoggedIn()) {
|
if (!this.isOauth() && this.isLoggedIn()) {
|
||||||
this.onLogin.next('logged-in');
|
this.onLogin.next('logged-in');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -201,18 +201,18 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
|||||||
return this.contentAuth.getToken();
|
return this.contentAuth.getToken();
|
||||||
} else if (this.isALLProvider()) {
|
} else if (this.isALLProvider()) {
|
||||||
return this.contentAuth.getToken();
|
return this.contentAuth.getToken();
|
||||||
}else{
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
getTicketEcm(): string{
|
getTicketEcm(): string {
|
||||||
return this.contentAuth.getToken();
|
return this.contentAuth.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
getTicketBpm(): string{
|
getTicketBpm(): string {
|
||||||
return this.processAuth.getToken();
|
return this.processAuth.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,6 +330,9 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
|||||||
return header.set('Authorization', ticket);
|
return header.set('Authorization', ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async requireAlfTicket(): Promise<void> {
|
||||||
|
return this.contentAuth.requireAlfTicket();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the BPM ticket from the Storage in Base 64 format.
|
* Gets the BPM ticket from the Storage in Base 64 format.
|
||||||
|
@@ -163,7 +163,7 @@ export class ContentAuth {
|
|||||||
* Get the current Ticket
|
* Get the current Ticket
|
||||||
* */
|
* */
|
||||||
getToken(): string {
|
getToken(): string {
|
||||||
if(!this.ticket){
|
if (!this.ticket) {
|
||||||
this.onError.next('error');
|
this.onError.next('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +202,11 @@ export class ContentAuth {
|
|||||||
return this.adfHttpClient.post(this.basePath + '/tickets', {bodyParam: ticketBodyCreate});
|
return this.adfHttpClient.post(this.basePath + '/tickets', {bodyParam: ticketBodyCreate});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async requireAlfTicket(): Promise<void> {
|
||||||
|
const ticket = await this.adfHttpClient.get(this.basePath + '/tickets/-me-');
|
||||||
|
this.setTicket(ticket.entry.id);
|
||||||
|
}
|
||||||
|
|
||||||
deleteTicket(): Promise<any> {
|
deleteTicket(): Promise<any> {
|
||||||
return this.adfHttpClient.delete(this.basePath + '/tickets/-me-');
|
return this.adfHttpClient.delete(this.basePath + '/tickets/-me-');
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssoImplicitLogin() {
|
ssoImplicitLogin() {
|
||||||
this.oauthService.initLoginFlow();
|
this.auth.login();
|
||||||
}
|
}
|
||||||
|
|
||||||
ssoCodeFlowLogin() {
|
ssoCodeFlowLogin() {
|
||||||
|
@@ -37,7 +37,7 @@ export class UploadActions {
|
|||||||
async uploadFile(fileLocation, fileName, parentFolderId): Promise<any> {
|
async uploadFile(fileLocation, fileName, parentFolderId): Promise<any> {
|
||||||
const file = fs.createReadStream(fileLocation);
|
const file = fs.createReadStream(fileLocation);
|
||||||
|
|
||||||
return this.uploadApi.uploadFile(
|
const uploadPromise = this.uploadApi.uploadFile(
|
||||||
file,
|
file,
|
||||||
'',
|
'',
|
||||||
parentFolderId,
|
parentFolderId,
|
||||||
@@ -48,6 +48,12 @@ export class UploadActions {
|
|||||||
renditions: 'doclib'
|
renditions: 'doclib'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
uploadPromise.then(() => {
|
||||||
|
Logger.info(`${fileName} uploaded in ${parentFolderId}`);
|
||||||
|
})
|
||||||
|
|
||||||
|
return uploadPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
|
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
|
||||||
@@ -74,6 +80,7 @@ export class UploadActions {
|
|||||||
async deleteFileOrFolder(nodeId: string) {
|
async deleteFileOrFolder(nodeId: string) {
|
||||||
const apiCall = async () => {
|
const apiCall = async () => {
|
||||||
try {
|
try {
|
||||||
|
Logger.error(`Deleting ${nodeId}`);
|
||||||
return this.nodesApi.deleteNode(nodeId, { permanent: true });
|
return this.nodesApi.deleteNode(nodeId, { permanent: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error delete file or folder');
|
Logger.error('Error delete file or folder');
|
||||||
@@ -91,8 +98,18 @@ export class UploadActions {
|
|||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
for (const fileName of files) {
|
for (const fileName of files) {
|
||||||
const pathFile = path.join(sourcePath, fileName);
|
const pathFile = path.join(sourcePath, fileName);
|
||||||
promises.push(this.uploadFile(pathFile, fileName, folder));
|
|
||||||
|
const uploadPromise = this.uploadFile(pathFile, fileName, folder);
|
||||||
|
|
||||||
|
await uploadPromise.then(() => {
|
||||||
|
Logger.info(`File ${fileName} uploaded successfully in ${folder}!`);
|
||||||
|
}).catch(() => {
|
||||||
|
Logger.error(`File ${fileName} error during the upload in ${folder}!`);
|
||||||
|
});
|
||||||
|
|
||||||
|
promises.push(uploadPromise);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadedFiles = await Promise.all(promises);
|
uploadedFiles = await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -83,6 +83,14 @@ export class IdentityService {
|
|||||||
const queryParams = {};
|
const queryParams = {};
|
||||||
const postBody = {};
|
const postBody = {};
|
||||||
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||||
|
|
||||||
|
const deletePromise = this.api.performIdentityOperation(path, method, queryParams, postBody)
|
||||||
|
|
||||||
|
deletePromise.then(() => {
|
||||||
|
Logger.info(`user ${userId} delete`);
|
||||||
|
})
|
||||||
|
|
||||||
|
return deletePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserInfoByUsername(username: string): Promise<any> {
|
async getUserInfoByUsername(username: string): Promise<any> {
|
||||||
|
@@ -66,6 +66,8 @@ export class LoginPage {
|
|||||||
Logger.log('Login With ' + username);
|
Logger.log('Login With ' + username);
|
||||||
const authType = await LocalStorageUtil.getConfigField('authType');
|
const authType = await LocalStorageUtil.getConfigField('authType');
|
||||||
|
|
||||||
|
Logger.log(`AuthType ${authType}`);
|
||||||
|
|
||||||
if (!authType || authType === 'OAUTH') {
|
if (!authType || authType === 'OAUTH') {
|
||||||
await this.loginSSOIdentityService(username, password, options);
|
await this.loginSSOIdentityService(username, password, options);
|
||||||
} else {
|
} else {
|
||||||
@@ -83,7 +85,10 @@ export class LoginPage {
|
|||||||
await BrowserActions.getUrl(loginURL);
|
await BrowserActions.getUrl(loginURL);
|
||||||
|
|
||||||
if (oauth2 && oauth2.silentLogin === false) {
|
if (oauth2 && oauth2.silentLogin === false) {
|
||||||
|
Logger.log(`Login SSO`);
|
||||||
await this.clickOnSSOButton();
|
await this.clickOnSSOButton();
|
||||||
|
}else{
|
||||||
|
Logger.log(`Login SSO silent login`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.usernameField);
|
await BrowserVisibility.waitUntilElementIsVisible(this.usernameField);
|
||||||
@@ -98,6 +103,8 @@ export class LoginPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loginBasicAuth(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }): Promise<void> {
|
async loginBasicAuth(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }): Promise<void> {
|
||||||
|
Logger.log(`Login Basic`);
|
||||||
|
|
||||||
await this.goToLoginPage();
|
await this.goToLoginPage();
|
||||||
|
|
||||||
await this.enterUsernameBasicAuth(username);
|
await this.enterUsernameBasicAuth(username);
|
||||||
|
@@ -23,7 +23,7 @@ export class FileBrowserUtil {
|
|||||||
|
|
||||||
static async isFileDownloaded(fileName: string): Promise<boolean> {
|
static async isFileDownloaded(fileName: string): Promise<boolean> {
|
||||||
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
|
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
|
||||||
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000);
|
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000,`${fileName} not downloaded`);
|
||||||
|
|
||||||
await expect(file).toBe(true, `${fileName} not downloaded`);
|
await expect(file).toBe(true, `${fileName} not downloaded`);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user