Merge pull request #435 from Alfresco/dev-denys-430

Fix ContentService
This commit is contained in:
Maurizio Vitale 2016-07-15 10:52:26 +01:00 committed by GitHub
commit ab2b3778ef
3 changed files with 10 additions and 7 deletions

View File

@ -28,9 +28,11 @@ export class AlfrescoAuthenticationECM extends AlfrescoAuthenticationBase implem
TYPE: string = 'ECM';
alfrescoApi: any;
/**
* Constructor
* @param alfrescoSettingsService
* @param http
*/
constructor(private alfrescoSettingsService: AlfrescoSettingsService,
private http: Http) {

View File

@ -36,6 +36,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
/**
* Constructor
* @param alfrescoSettingsService
* @param http
*/
constructor(private alfrescoSettingsService: AlfrescoSettingsService,
private http: Http) {
@ -47,6 +48,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
* Method to delegate to POST login
* @param username
* @param password
* @param providers
* @returns {Observable<R>|Observable<T>}
*/
login(username: string, password: string, providers: string []): Observable<string> {
@ -63,6 +65,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
*
* @param username
* @param password
* @param providers
* @returns {Observable<R>|Observable<T>}
*/
private performeLogin(username: string, password: string, providers: string []): Observable<any> {
@ -104,7 +107,7 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
/**
* Return the ticket stored in the localStorage of the specific provider type
* @param ticket
* @param type
*/
public getTicket(type: string = 'ECM'): string {
let auth: AbstractAuthentication = this.findProviderInstance(type);
@ -122,18 +125,16 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
if (this.providersInstance.length === 0) {
return Observable.throw('No providers defined');
} else {
return this.performeLogout();
return this.performLogout();
}
}
/**
* Perform a logout on behalf of the user for the different provider instance
*
* @param username
* @param password
* @returns {Observable<R>|Observable<T>}
*/
private performeLogout(): Observable<any> {
private performLogout(): Observable<any> {
let observableBatch = [];
this.providersInstance.forEach((authInstance) => {
observableBatch.push(authInstance.logout());

View File

@ -31,7 +31,7 @@ export class AlfrescoContentService {
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(document: any): string {
return this.authService.alfrescoApi.content.getDocumentThumbnailUrl(document.entry.id);
return this.authService.getAlfrescoApi().content.getDocumentThumbnailUrl(document.entry.id);
}
/**
@ -40,6 +40,6 @@ export class AlfrescoContentService {
* @returns {string} URL address.
*/
getContentUrl(document: any): string {
return this.authService.alfrescoApi.content.getContentUrl(document.entry.id);
return this.authService.getAlfrescoApi().content.getContentUrl(document.entry.id);
}
}