mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
rename "apiAuth" to "login"
This commit is contained in:
@@ -57,7 +57,7 @@ export class FavoritesApi extends RepoApi {
|
||||
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry | null> {
|
||||
let guid;
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
if (nodeType === 'site') {
|
||||
guid = (await this.sitesApi.getSite(id)).entry.guid;
|
||||
} else {
|
||||
@@ -94,7 +94,7 @@ export class FavoritesApi extends RepoApi {
|
||||
|
||||
async getFavorites() {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.favoritesApi.listFavorites(this.username);
|
||||
} catch (error) {
|
||||
this.handleError(`FavoritesApi getFavorites : catch : `, error);
|
||||
@@ -104,7 +104,7 @@ export class FavoritesApi extends RepoApi {
|
||||
|
||||
async getFavoritesTotalItems(): Promise<number> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return (await this.favoritesApi.listFavorites(this.username)).list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
this.handleError(`FavoritesApi getFavoritesTotalItems : catch : `, error);
|
||||
@@ -114,7 +114,7 @@ export class FavoritesApi extends RepoApi {
|
||||
|
||||
async getFavoriteById(nodeId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.favoritesApi.getFavorite('-me-', nodeId);
|
||||
} catch (error) {
|
||||
this.handleError(`FavoritesApi getFavoriteById : catch : `, error);
|
||||
@@ -149,7 +149,7 @@ export class FavoritesApi extends RepoApi {
|
||||
|
||||
async removeFavoriteById(nodeId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.favoritesApi.deleteFavorite('-me-', nodeId);
|
||||
} catch (error) {
|
||||
this.handleError(`FavoritesApi removeFavoriteById : catch : `, error);
|
||||
|
@@ -38,7 +38,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async getNodeByPath(relativePath: string = '/', parentFolderId: string = '-my-'): Promise<NodeEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.getNode(parentFolderId, { relativePath });
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.getNodeByPath.name}`, error);
|
||||
@@ -48,7 +48,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async getNodeById(id: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.getNode(id);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.getNodeById.name}`, error);
|
||||
@@ -148,7 +148,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async deleteNodeById(id: string, permanent: boolean = true): Promise<void> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
await this.nodesApi.deleteNode(id, { permanent });
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.deleteNodeById.name}`, error);
|
||||
@@ -191,7 +191,7 @@ export class NodesApi extends RepoApi {
|
||||
const opts = {
|
||||
include: ['properties']
|
||||
};
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.listNodeChildren(nodeId, opts);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.getNodeChildren.name}`, error);
|
||||
@@ -256,7 +256,7 @@ export class NodesApi extends RepoApi {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.createNode(parentId, nodeBody, {
|
||||
majorVersion
|
||||
});
|
||||
@@ -310,7 +310,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async createChildren(data: NodeBodyCreate[]): Promise<NodeEntry | any> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.createNode('-my-', data as any);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error);
|
||||
@@ -343,7 +343,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async addAspects(nodeId: string, aspectNames: string[]): Promise<NodeEntry> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.nodesApi.updateNode(nodeId, { aspectNames });
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.addAspects.name}`, error);
|
||||
@@ -362,7 +362,7 @@ export class NodesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const link = await this.nodesApi.createNode(destinationId, nodeBody);
|
||||
await this.addAspects(originalNodeId, ['app:linked']);
|
||||
return link;
|
||||
@@ -386,7 +386,7 @@ export class NodesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const link = await this.nodesApi.createNode(destinationId, nodeBody);
|
||||
await this.addAspects(originalNodeId, ['app:linked']);
|
||||
return link;
|
||||
@@ -399,7 +399,7 @@ export class NodesApi extends RepoApi {
|
||||
// node content
|
||||
async getNodeContent(nodeId: string): Promise<any> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.getNodeContent(nodeId);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.getNodeContent.name}`, error);
|
||||
@@ -419,7 +419,7 @@ export class NodesApi extends RepoApi {
|
||||
comment,
|
||||
name: newName
|
||||
};
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.updateNodeContent(nodeId, content, opts);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.updateNodeContent.name}`, error);
|
||||
@@ -429,7 +429,7 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
async renameNode(nodeId: string, newName: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.nodesApi.updateNode(nodeId, { name: newName });
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.renameNode.name}`, error);
|
||||
@@ -446,7 +446,7 @@ export class NodesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.updateNode(nodeId, data);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error);
|
||||
@@ -468,7 +468,7 @@ export class NodesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.updateNode(nodeId, data);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.setGranularPermission.name}`, error);
|
||||
@@ -483,7 +483,7 @@ export class NodesApi extends RepoApi {
|
||||
} as NodeBodyLock;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.lockNode(nodeId, data);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.lockFile.name}`, error);
|
||||
@@ -494,7 +494,7 @@ export class NodesApi extends RepoApi {
|
||||
/* @deprecated check {UserActions.unlockNodes} instead. */
|
||||
async unlockFile(nodeId: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.nodesApi.unlockNode(nodeId);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.unlockFile.name}`, error);
|
||||
|
@@ -42,7 +42,7 @@ export class QueriesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.queriesApi.findSites(searchTerm, data);
|
||||
} catch (error) {
|
||||
this.handleError(`QueriesApi findSites : catch : `, error);
|
||||
@@ -66,7 +66,7 @@ export class QueriesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.queriesApi.findNodes(searchTerm, data);
|
||||
} catch (error) {
|
||||
this.handleError(`QueriesApi findNodes : catch : `, error);
|
||||
|
@@ -34,7 +34,7 @@ export abstract class RepoApi {
|
||||
this.alfrescoJsApi.setConfig(browser.params.config);
|
||||
}
|
||||
|
||||
apiAuth(): Promise<any> {
|
||||
login(): Promise<any> {
|
||||
return this.alfrescoJsApi.login(this.username, this.password);
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ export class SearchApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.searchApi.search(data);
|
||||
} catch (error) {
|
||||
this.handleError(`SearchApi queryRecentFiles : catch : `, error);
|
||||
@@ -76,7 +76,7 @@ export class SearchApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.searchApi.search(data);
|
||||
} catch (error) {
|
||||
this.handleError(`SearchApi queryNodesNames : catch : `, error);
|
||||
@@ -103,7 +103,7 @@ export class SearchApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return this.searchApi.search(data);
|
||||
} catch (error) {
|
||||
this.handleError(`SearchApi queryNodesExactNames : catch : `, error);
|
||||
|
@@ -37,7 +37,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
|
||||
async shareFileById(id: string, expireDate?: Date): Promise<SharedLinkEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const data = {
|
||||
nodeId: id,
|
||||
expiresAt: expireDate
|
||||
@@ -86,7 +86,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
|
||||
async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const opts = {
|
||||
maxItems
|
||||
};
|
||||
@@ -99,7 +99,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
|
||||
async getSharedLinksTotalItems(): Promise<number> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const opts = {
|
||||
maxItems: 250
|
||||
};
|
||||
|
@@ -46,7 +46,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async getSite(siteId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.getSite(siteId);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi getSite : catch : `, error);
|
||||
@@ -56,7 +56,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async getSites() {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.listSiteMembershipsForPerson(this.username);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi getSites : catch : `, error);
|
||||
@@ -66,7 +66,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async getSitesTotalItems(): Promise<number> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return (await this.sitesApi.listSiteMembershipsForPerson(this.username)).list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi getSitesTotalItems : catch : `, error);
|
||||
@@ -76,7 +76,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async getDocLibId(siteId: string): Promise<string> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id;
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi getDocLibId : catch : `, error);
|
||||
@@ -123,7 +123,7 @@ export class SitesApi extends RepoApi {
|
||||
} as SiteBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.createSite(site);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi createSite : catch : `, error);
|
||||
@@ -160,7 +160,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async deleteSite(siteId: string, permanent: boolean = true) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.deleteSite(siteId, { permanent });
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi deleteSite : catch : `, error);
|
||||
@@ -170,7 +170,7 @@ export class SitesApi extends RepoApi {
|
||||
async deleteSites(siteIds: string[], permanent: boolean = true) {
|
||||
try {
|
||||
if (siteIds && siteIds.length > 0) {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
|
||||
for (const siteId of siteIds) {
|
||||
await this.sitesApi.deleteSite(siteId, { permanent });
|
||||
@@ -200,7 +200,7 @@ export class SitesApi extends RepoApi {
|
||||
} as SiteMemberRoleBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi updateSiteMember : catch : `, error);
|
||||
@@ -215,7 +215,7 @@ export class SitesApi extends RepoApi {
|
||||
} as SiteMemberBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.createSiteMembership(siteId, memberBody);
|
||||
} catch (error) {
|
||||
if (error.status === 409) {
|
||||
@@ -245,7 +245,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async deleteSiteMember(siteId: string, userId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.deleteSiteMembership(siteId, userId);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi deleteSiteMember : catch : `, error);
|
||||
@@ -258,7 +258,7 @@ export class SitesApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi requestToJoin : catch : `, error);
|
||||
@@ -268,7 +268,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
async hasMembershipRequest(siteId: string) {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map((e) => e.entry.id);
|
||||
return requests.includes(siteId);
|
||||
} catch (error) {
|
||||
|
@@ -44,7 +44,7 @@ export class UploadApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.uploadFile.name}`, error);
|
||||
@@ -66,7 +66,7 @@ export class UploadApi extends RepoApi {
|
||||
};
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
await this.login();
|
||||
return await this.upload.uploadFile(file, '', parentId, nodeProps, opts);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
|
||||
|
Reference in New Issue
Block a user