diff --git a/docs/README.md b/docs/README.md index 65ea2e4d17..e61a6275c7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -233,6 +233,7 @@ for more information about installing and using the source code. | [Thumbnail service](core/services/thumbnail.service.md) | Retrieves an SVG thumbnail image to represent a document type. | [Source](../lib/core/services/thumbnail.service.ts) | | [Translation service](core/services/translation.service.md) | Supports localisation. | [Source](../lib/core/services/translation.service.ts) | | [Upload Service](core/services/upload.service.md) | Provides access to various APIs related to file upload features. | [Source](../lib/core/services/upload.service.ts) | +| [User access service](core/services/user-access.service.md) | Checks the global and application access of a user | [Source](../lib/core/services/user-access.service.ts) | | [User Preferences Service](core/services/user-preferences.service.md) | Stores preferences for the app and for individual components. | [Source](../lib/core/services/user-preferences.service.ts) | ### Widgets @@ -354,6 +355,7 @@ for more information about installing and using the source code. | [Document Actions service](content-services/services/document-actions.service.md) | Implements the document menu actions for the Document List component. | [Source](../lib/content-services/src/lib/document-list/services/document-actions.service.ts) | | [Document List service](content-services/services/document-list.service.md) | Implements node operations used by the Document List component. | [Source](../lib/content-services/src/lib/document-list/services/document-list.service.ts) | | [Folder Actions service](content-services/services/folder-actions.service.md) | Implements the folder menu actions for the Document List component. | [Source](../lib/content-services/src/lib/document-list/services/folder-actions.service.ts) | +| [New Version Uploader service](content-services/services/new-version-uploader.dialog.service.md) | Display a dialog that allows to upload new file version or to manage the current node versions. | [Source](../lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts) | | [Node permission dialog service](content-services/services/node-permission-dialog.service.md) | Displays dialogs to let the user set node permissions. | [Source](../lib/content-services/src/lib/permission-manager/services/node-permission-dialog.service.ts) | | [Node Permission service](content-services/services/node-permission.service.md) | Manages role permissions for content nodes. | [Source](../lib/content-services/src/lib/permission-manager/services/node-permission.service.ts) | | [Rating service](content-services/services/rating.service.md) | Manages ratings for items in Content Services. | [Source](../lib/content-services/src/lib/social/services/rating.service.ts) | diff --git a/docs/content-services/services/audit.service.md b/docs/content-services/services/audit.service.md index 102471c4d6..dfa9a0610b 100644 --- a/docs/content-services/services/audit.service.md +++ b/docs/content-services/services/audit.service.md @@ -23,34 +23,34 @@ Manages Audit apps and entries. - _auditApplicationId:_ `string` - The identifier of an audit application. - _auditEntryId:_ `string` - The identifier of an audit entry. - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - -- **getAuditApp**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditAppEntry`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditAppEntry.ts)`>`
+- **getAuditApp**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Get audit application info. - _auditApplicationId:_ `string` - The identifier of an audit application. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditAppEntry`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditAppEntry.ts)`>` - -- **getAuditApps**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditAppPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditAppPaging.ts)`>`
+ - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - +- **getAuditApps**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
List audit applications. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditAppPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditAppPaging.ts)`>` - -- **getAuditEntries**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryPaging.ts)`>`
+ - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - +- **getAuditEntries**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
List audit entries for an audit application. - _auditApplicationId:_ `string` - The identifier of an audit application. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryPaging.ts)`>` - -- **getAuditEntriesForNode**(nodeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryPaging.ts)`>`
+ - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - +- **getAuditEntriesForNode**(nodeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
List audit entries for a node. - _nodeId:_ `string` - The identifier of a node. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryPaging.ts)`>` - -- **getAuditEntry**(auditApplicationId: `string`, auditEntryId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryEntry`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryEntry.ts)`>`
+ - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - +- **getAuditEntry**(auditApplicationId: `string`, auditEntryId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Get audit entry. - _auditApplicationId:_ `string` - The identifier of an audit application. - _auditEntryId:_ `string` - The identifier of an audit entry. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditEntryEntry`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditEntryEntry.ts)`>` - -- **updateAuditApp**(auditApplicationId: `string`, auditAppBodyUpdate: `boolean`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditApp`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditApp.ts)`|__type>`
+ - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - +- **updateAuditApp**(auditApplicationId: `string`, auditAppBodyUpdate: `boolean`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Update audit application info. - _auditApplicationId:_ `string` - The identifier of an audit application. - _auditAppBodyUpdate:_ `boolean` - The audit application to update. - - _opts:_ `any` - (Optional)Options. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AuditApp`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/auditApp.ts)`|__type>` - + - _opts:_ `any` - (Optional) Options. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - diff --git a/docs/content-services/services/new-version-uploader.dialog.service.md b/docs/content-services/services/new-version-uploader.dialog.service.md index 724e11caac..7f6ed398b7 100644 --- a/docs/content-services/services/new-version-uploader.dialog.service.md +++ b/docs/content-services/services/new-version-uploader.dialog.service.md @@ -13,29 +13,31 @@ Display a dialog that allows to upload new file version or to manage the current ### Methods -- **openUploadNewVersionDialog**(data: [NewVersionUploaderDialogData](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts), config: `MatDialogConfig`): `Observable`
- Opens a dialog to upload new file version or to manage current node versions - - _data:_ [NewVersionUploaderDialogData](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts) - The data to pass to the dialog - - _config:_ `MatDialogConfig` - A configuration object that allows to override default dialog configuration - - **Returns** `Observable` - [`Observable`](http://reactivex.io/documentation/observable.html) which you can subscribe in order to get information about the dialog actions or error notification in case of error condition. +- **openUploadNewVersionDialog**(data: [`NewVersionUploaderDialogData`](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts), config: `MatDialogConfig`): [`Observable`](http://reactivex.io/documentation/observable.html)
+ Opens a dialog to upload new file version or to manage current node versions + - _data:_ [`NewVersionUploaderDialogData`](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts) - The data to pass to the dialog + - _config:_ `MatDialogConfig` - A configuration object that allows to override default dialog configuration + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html) - [`Observable`](http://reactivex.io/documentation/observable.html) which you can subscribe in order to get information about the dialog actions or error notification in case of error condition. + ## Details You can open dialog in two different ways: -- [Upload new file version](#upload-new-version) -- [Manage node versions](#manage-versions) +- [Upload new file version](#upload-new-version) +- [Manage node versions](#manage-versions) ### Upload New Version The dialog shows -- a side by side comparison between the current target node (type, name, icon) and the new file that should update it's version -- the new version's minor/major changes -- the optional comment -- a button to upload a new file version - ![Upload new version image](../../docassets/images/adf-new-version-uploader_upload.png) +- a side by side comparison between the current target node (type, name, icon) and the new file that should update it's version +- the new version's minor/major changes +- the optional comment +- a button to upload a new file version + ![Upload new version image](../../docassets/images/adf-new-version-uploader_upload.png) Usage example: + ```ts import { NewVersionUploaderService } from '@alfresco/adf-content-services' @@ -56,7 +58,7 @@ yourFunctionToOpenDialog(){ } ``` ---- +* * * ### Manage Versions @@ -64,6 +66,7 @@ Setting `showVersionsOnly` to `true` the dialog displays the version history of ![Manage versions image](../../docassets/images/adf-new-version-uploader_manage-versions.png) Usage example: + ```ts import { NewVersionUploaderService } from '@alfresco/adf-content-services' @@ -84,6 +87,6 @@ yourFunctionToOpenDialog(){ ## See Also -- [Version list component](../components/docs/content-services/components/version-list.component.md) -- [Version Comparison Component](../components/docs/content-services/components/version-comparison.component.md) -- [Version Upload Component](../components/docs/content-services/components/version-upload.component.md) +- [Version list component](../components/docs/content-services/components/version-list.component.md) +- [Version Comparison Component](../components/docs/content-services/components/version-comparison.component.md) +- [Version Upload Component](../components/docs/content-services/components/version-upload.component.md) diff --git a/docs/content-services/services/rating.service.md b/docs/content-services/services/rating.service.md index 6bd48bcafb..2c50ac4828 100644 --- a/docs/content-services/services/rating.service.md +++ b/docs/content-services/services/rating.service.md @@ -18,17 +18,17 @@ Manages ratings for items in Content Services. - _nodeId:_ `string` - Target node - _ratingType:_ `any` - Type of rating to remove (can be "likes" or "fiveStar") - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - Null response indicating that the operation is complete -- **getRating**(nodeId: `string`, ratingType: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|__type>`
+- **getRating**(nodeId: `string`, ratingType: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|any>`
Gets the current user's rating for a node. - _nodeId:_ `string` - Node to get the rating from - _ratingType:_ `any` - Type of rating (can be "likes" or "fiveStar") - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|__type>` - The rating value -- **postRating**(nodeId: `string`, ratingType: `string`, vote: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|__type>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|any>` - The rating value +- **postRating**(nodeId: `string`, ratingType: `string`, vote: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|any>`
Adds the current user's rating for a node. - _nodeId:_ `string` - Target node for the rating - _ratingType:_ `string` - Type of rating (can be "likes" or "fiveStar") - _vote:_ `any` - Rating value (boolean for "likes", numeric 0..5 for "fiveStar") - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|__type>` - Details about the rating, including the new value + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RatingEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/RatingEntry.md)`|any>` - Details about the rating, including the new value ## Details diff --git a/docs/content-services/services/search-query-builder.service.md b/docs/content-services/services/search-query-builder.service.md index c3e82a8e3f..923db7f037 100644 --- a/docs/content-services/services/search-query-builder.service.md +++ b/docs/content-services/services/search-query-builder.service.md @@ -45,9 +45,9 @@ Stores information from all the custom search and faceted search widgets, compil Gets the query group. - _query:_ `any` - Target query - **Returns** `any` - Query group -- **getScope**(): [`RequestScope`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/search-rest-api/model/requestScope.ts)
+- **getScope**(): `RequestScope`
- - **Returns** [`RequestScope`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/search-rest-api/model/requestScope.ts) - + - **Returns** `RequestScope` - - **getSearchFormDetails**(): [`SearchForm`](../../../lib/content-services/src/lib/search/models/search-form.interface.ts)`[]`
@@ -86,9 +86,9 @@ Stores information from all the custom search and faceted search widgets, compil - _queryBody:_ `QueryBody` - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ResultSetPaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/search-rest-api/docs/ResultSetPaging.md)`>` - -- **setScope**(scope: [`RequestScope`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/search-rest-api/model/requestScope.ts))
+- **setScope**(scope: `RequestScope`)
- - _scope:_ [`RequestScope`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/search-rest-api/model/requestScope.ts) - + - _scope:_ `RequestScope` - - **update**(queryBody?: `QueryBody`)
Builds the current query and triggers the `updated` event. diff --git a/docs/core/components/data-column.component.md b/docs/core/components/data-column.component.md index ad6e280df1..363315a672 100644 --- a/docs/core/components/data-column.component.md +++ b/docs/core/components/data-column.component.md @@ -21,7 +21,7 @@ Defines column properties for DataTable, Tasklist, Document List and other compo - [Column Template](#column-template) - [Styling Techniques](#styling-techniques) - [Using the copyContent option](#using-the-copycontent-option) - - [Exapmple of column customData](#example-of-column-customData) + - [Example of column customData](#example-of-column-customdata) - [See also](#see-also) ## Basic Usage @@ -44,18 +44,18 @@ Defines column properties for DataTable, Tasklist, Document List and other compo | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | -| id | `string` | '' | Column identifier. | | copyContent | `boolean` | | Enables/disables a [Clipboard directive](../../core/directives/clipboard.directive.md) to allow copying of cell contents. | | cssClass | `string` | | Additional CSS class to be applied to column (header and cells). | +| customData | `any` | | You can specify any custom data which can be used by any specific feature | +| draggable | `boolean` | false | Toggles drag and drop for header column. | | editable | `boolean` | false | Toggles the editing support of the column data. | | focus | `boolean` | true | Enable or disable cell focus | | format | `string` | | Value format (if supported by the parent component), for example format of the date. | | formatTooltip | `Function` | | Custom tooltip formatter function. | +| id | `string` | "" | Column identifier. | +| isHidden | `boolean` | false | Hides columns | | key | `string` | | Data source key. Can be either a column/property key like `title` or a property path like `createdBy.name`. | | sortable | `boolean` | true | Toggles ability to sort by this column, for example by clicking the column header. | -| customData | `Generic` | any | Any feature specific data | -| draggable | `boolean` | false | Toggles drag and drop for header column. | -| isHidden | `boolean` | false | Hides columns | | sortingKey | `string` | | When using server side sorting the column used by the api call where the sorting will be performed | | srTitle | `string` | | Title to be used for screen readers. | | title | `string` | "" | Display title of the column, typically used for column headers. You can use the i18n resource key to get it translated automatically. | @@ -363,7 +363,7 @@ HTML `` element example: ``` -You can use generic type for `DataColumn` in order to get intellisense working e.g. +You can use generic type for [`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts) in order to get intellisense working e.g. ```ts const dataColumn: DataColumn<{ shouldPerformActionIfDisplayed: boolean }> = { diff --git a/docs/core/components/datatable.component.md b/docs/core/components/datatable.component.md index faa23e04ba..636c39d04d 100644 --- a/docs/core/components/datatable.component.md +++ b/docs/core/components/datatable.component.md @@ -375,6 +375,7 @@ Learm more about styling your datatable: [Customizing the component's styles](#c | display | `string` | DisplayMode.List | Selects the display mode of the table. Can be "list" or "gallery". | | fallbackThumbnail | `string` | | Fallback image for rows where the thumbnail is missing. | | loading | `boolean` | false | Flag that indicates if the datatable is in loading state and needs to show the loading template (see the docs to learn how to configure a loading template). | +| mainTableAction | `boolean` | true | Toggles main data table action column. | | multiselect | `boolean` | false | Toggles multiple row selection, which renders checkboxes at the beginning of each row. | | noPermission | `boolean` | false | Flag that indicates if the datatable should show the "no permission" template. | | resolverFn | `Function` | null | Custom resolver function which is used to parse dynamic column objects see the docs to learn how to configure a resolverFn. | @@ -384,6 +385,7 @@ Learm more about styling your datatable: [Customizing the component's styles](#c | rows | `any[]` | \[] | The rows that the datatable will show. | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | showHeader | `ShowHeaderMode` | | Toggles the header. | +| showMainDatatableActions | `boolean` | false | Toggles the main datatable action. | | sorting | `any[]` | \[] | Define the sort order of the datatable. Possible values are : [`created`, `desc`], [`created`, `asc`], [`due`, `desc`], [`due`, `asc`] | | stickyHeader | `boolean` | false | Toggles the sticky header mode. | @@ -391,13 +393,12 @@ Learm more about styling your datatable: [Customizing the component's styles](#c | Name | Type | Description | | ---- | ---- | ----------- | +| columnOrderChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts)`<>[]>` | Emitted after dragging and dropping column header. | | executeRowAction | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataRowActionEvent`](../../../lib/core/datatable/components/data-row-action.event.ts)`>` | Emitted when the user executes a row action. | | rowClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataRowEvent`](../../../lib/core/datatable/data/data-row-event.model.ts)`>` | Emitted when the user clicks a row. | | rowDblClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataRowEvent`](../../../lib/core/datatable/data/data-row-event.model.ts)`>` | Emitted when the user double-clicks a row. | | showRowActionsMenu | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataCellEvent`](../../../lib/core/datatable/components/data-cell.event.ts)`>` | Emitted before the actions menu is displayed for a row. | | showRowContextMenu | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataCellEvent`](../../../lib/core/datatable/components/data-cell.event.ts)`>` | Emitted before the context menu is displayed for a row. | -| columnOrderChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataColumn`](../../../lib/core/datatable/components/data-cell.event.ts)`>` | Emitted after dragging and dropping column header. | - ## Details diff --git a/docs/core/components/form-field.component.md b/docs/core/components/form-field.component.md index 7f5d40704c..bab9485563 100644 --- a/docs/core/components/form-field.component.md +++ b/docs/core/components/form-field.component.md @@ -27,7 +27,7 @@ based on the field type or the metadata information. | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | -| field | [`FormFieldModel`](../../core/models/form-field.model.md) | null | Contains all the necessary data needed to determine what UI [`Widget`](../../../lib/testing/src/lib/core/pages/form/widgets/widget.ts) to use when rendering the field in the form. You would typically not create this data manually but instead create the form in APS and export it to get to all the `FormFieldModel` definitions. | +| field | [`FormFieldModel`](../../core/models/form-field.model.md) | null | Contains all the necessary data needed to determine what UI Widget to use when rendering the field in the form. You would typically not create this data manually but instead create the form in APS and export it to get to all the [`FormFieldModel`](../../core/models/form-field.model.md) definitions. | ## Details diff --git a/docs/core/components/start-form.component.md b/docs/core/components/start-form.component.md index 15d831511b..a2c547f49b 100644 --- a/docs/core/components/start-form.component.md +++ b/docs/core/components/start-form.component.md @@ -38,7 +38,7 @@ Displays the Start [`Form`](../../../lib/process-services/src/lib/task-list/mode | nameNode | `string` | | Name to assign to the new node where the metadata are stored. | | nodeId | `string` | | Content Services node ID for the form metadata. | | path | `string` | | Path of the folder where the metadata will be stored. | -| processDefinitionId | `string` | | [Definition](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/definition.ts) ID of the process to start, this parameter can not be use in combination with processId | +| processDefinitionId | `string` | | Definition ID of the process to start, this parameter can not be use in combination with processId | | processId | `string` | | Process ID of the process to start, this parameter can not be use in combination with processDefinitionId | | readOnly | `boolean` | false | Toggle readonly state of the form. Forces all form widgets to render as readonly if enabled. | | readOnlyForm | `boolean` | false | Is the form read-only (ie, can't be edited)? | diff --git a/docs/core/services/app-config.service.md b/docs/core/services/app-config.service.md index c190caeeb9..93f804977a 100644 --- a/docs/core/services/app-config.service.md +++ b/docs/core/services/app-config.service.md @@ -30,6 +30,10 @@ Supports app configuration settings, stored server side. - **load**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)``
Loads the config file. - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`` - Notification when loading is complete +- **loadWellKnown**(hostIdp: `string`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`OpenidConfiguration`](../../../lib/core/services/openid-configuration.interface.ts)`>`
+ Call the discovery API to fetch configuration + - _hostIdp:_ `string` - + - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`OpenidConfiguration`](../../../lib/core/services/openid-configuration.interface.ts)`>` - Discovery configuration - **select**(property: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Requests notification of a property value when it is loaded. - _property:_ `string` - The desired property value diff --git a/docs/core/services/card-item-types.service.md b/docs/core/services/card-item-types.service.md index 8ea69912a0..bc2b2937a2 100644 --- a/docs/core/services/card-item-types.service.md +++ b/docs/core/services/card-item-types.service.md @@ -13,20 +13,20 @@ Maps type names to field component types for the [Card View component](../compon ### Methods -- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<__type>` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)
+- **getComponentTypeResolver**(type: `string`, defaultValue: `Type` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)
Gets the currently active [DynamicComponentResolveFunction](../../../lib/core/services/dynamic-component-mapper.service.ts) for a field type. - _type:_ `string` - The type whose resolver you want - - _defaultValue:_ `Type<__type>` - Default type returned for types that are not yet mapped + - _defaultValue:_ `Type` - Default type returned for types that are not yet mapped - **Returns** [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts) - Resolver function - **register**(components: `Function`, override: `boolean` = `false`)
Register multiple components - _components:_ `Function` - - _override:_ `boolean` - -- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<__type>` = `this.defaultValue`): `Type<__type>`
+- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type` = `this.defaultValue`): `Type`
Finds the component type that is needed to render a form field. - _model:_ [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts) - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) field model for the field to render - - _defaultValue:_ `Type<__type>` - Default type returned for field types that are not yet mapped. - - **Returns** `Type<__type>` - Component type + - _defaultValue:_ `Type` - Default type returned for field types that are not yet mapped. + - **Returns** `Type` - Component type - **setComponentTypeResolver**(type: `string`, resolver: [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts), override: `boolean` = `true`)
Sets or optionally replaces a [DynamicComponentResolveFunction](../../../lib/core/services/dynamic-component-mapper.service.ts) for a field type. - _type:_ `string` - The type whose resolver you want to set diff --git a/docs/core/services/deleted-nodes-api.service.md b/docs/core/services/deleted-nodes-api.service.md index cb40491ae6..3144e74f3d 100644 --- a/docs/core/services/deleted-nodes-api.service.md +++ b/docs/core/services/deleted-nodes-api.service.md @@ -13,9 +13,9 @@ Gets a list of Content Services nodes currently in the trash. ### Methods -- **getDeletedNodes**(options?: `Object`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>`
+- **getDeletedNodes**(options?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>`
Gets a list of nodes in the trash. - - _options:_ `Object` - (Optional) Options for JS-API call + - _options:_ `any` - (Optional) Options for JS-API call - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>` - List of nodes in the trash ## Details diff --git a/docs/core/services/discovery-api.service.md b/docs/core/services/discovery-api.service.md index 7fc8b9dfd4..aeea958639 100644 --- a/docs/core/services/discovery-api.service.md +++ b/docs/core/services/discovery-api.service.md @@ -20,9 +20,9 @@ Gets version and license information for Process Services and Content Services. - **getBpmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>`
Gets product information for Process Services. - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>` - ProductVersionModel containing product details -- **getEcmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RepositoryInfo`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/discovery-rest-api/model/repositoryInfo.ts)`>`
+- **getEcmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)``
Gets product information for Content Services. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RepositoryInfo`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/discovery-rest-api/model/repositoryInfo.ts)`>` - ProductVersionModel containing product details + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - ProductVersionModel containing product details ## Details diff --git a/docs/core/services/favorites-api.service.md b/docs/core/services/favorites-api.service.md index ed1b7b97e1..0aebb08b7a 100644 --- a/docs/core/services/favorites-api.service.md +++ b/docs/core/services/favorites-api.service.md @@ -23,9 +23,9 @@ Gets a list of items a user has marked as their favorites. - _entries:_ `any[]` - - **Returns** `any[]` - -- **remapFavoritesData**(data: [`FavoritePaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/favoritePaging.ts) = `{}`): [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)
+- **remapFavoritesData**(data: `FavoritePaging` = `{}`): [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)
- - _data:_ [`FavoritePaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/favoritePaging.ts) - + - _data:_ `FavoritePaging` - - **Returns** [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md) - - **remapEntry**(\_\_namedParameters: `Function`): `any`
diff --git a/docs/core/services/form-rendering.service.md b/docs/core/services/form-rendering.service.md index e9d178a564..fbfb99aa2f 100644 --- a/docs/core/services/form-rendering.service.md +++ b/docs/core/services/form-rendering.service.md @@ -13,20 +13,20 @@ Maps a form field type string onto the corresponding form [widget component](../ ### Methods -- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<__type>` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)
+- **getComponentTypeResolver**(type: `string`, defaultValue: `Type` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)
Gets the currently active [DynamicComponentResolveFunction](../../../lib/core/services/dynamic-component-mapper.service.ts) for a field type. - _type:_ `string` - The type whose resolver you want - - _defaultValue:_ `Type<__type>` - Default type returned for types that are not yet mapped + - _defaultValue:_ `Type` - Default type returned for types that are not yet mapped - **Returns** [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts) - Resolver function - **register**(components: `Function`, override: `boolean` = `false`)
Register multiple components - _components:_ `Function` - - _override:_ `boolean` - -- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<__type>` = `this.defaultValue`): `Type<__type>`
+- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type` = `this.defaultValue`): `Type`
Finds the component type that is needed to render a form field. - _model:_ [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts) - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) field model for the field to render - - _defaultValue:_ `Type<__type>` - Default type returned for field types that are not yet mapped. - - **Returns** `Type<__type>` - Component type + - _defaultValue:_ `Type` - Default type returned for field types that are not yet mapped. + - **Returns** `Type` - Component type - **setComponentTypeResolver**(type: `string`, resolver: [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts), override: `boolean` = `true`)
Sets or optionally replaces a [DynamicComponentResolveFunction](../../../lib/core/services/dynamic-component-mapper.service.ts) for a field type. - _type:_ `string` - The type whose resolver you want to set diff --git a/docs/core/services/jwt-helper.service.md b/docs/core/services/jwt-helper.service.md index 873000a0b6..bd76b41a67 100644 --- a/docs/core/services/jwt-helper.service.md +++ b/docs/core/services/jwt-helper.service.md @@ -13,10 +13,10 @@ Decodes a JSON Web Token (JWT) to a JavaScript object. ### Methods -- **decodeToken**(token: `any`): `Object`
+- **decodeToken**(token: `any`): `any`
Decodes a JSON web token into a JS object. - _token:_ `any` - Token in encoded form - - **Returns** `Object` - Decoded token data object + - **Returns** `any` - Decoded token data object - **getAccessToken**(): `string`
Gets access token - **Returns** `string` - access token diff --git a/docs/core/services/people-content.service.md b/docs/core/services/people-content.service.md index 76e5777029..05e97766be 100644 --- a/docs/core/services/people-content.service.md +++ b/docs/core/services/people-content.service.md @@ -18,25 +18,30 @@ Gets information about a Content Services user. - _newPerson:_ [`PersonBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/model/personBodyCreate.ts) - Object containing the new person details. - _opts:_ `any` - (Optional) Optional parameters - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - Created new person -- **getCurrentPerson**(): [`Observable`](http://reactivex.io/documentation/observable.html)``
- Gets information about the user who is currently logged in. - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - User information -- **getPerson**(personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
+- **getCurrentUserInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`
+ Gets information about the current user alias -me- + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - User information +- **getPerson**(personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`
Gets information about a user identified by their username. - _personId:_ `string` - ID of the target user - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - User information -- **isContentAdmin**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)``
- - - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`` - - + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - User information +- **getUserProfileImage**(avatarId: `string`): `string`
+ Returns a profile image as a URL. + - _avatarId:_ `string` - Target avatar + - **Returns** `string` - Image URL +- **isCurrentUserAdmin**(): `boolean`
+ Used to know if the current user has the admin capability + - **Returns** `boolean` - true or false - **listPeople**(requestQuery?: [`PeopleContentQueryRequestModel`](../../../lib/core/services/people-content.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](../../../lib/core/services/people-content.service.ts)`>`
Gets a list of people. - _requestQuery:_ [`PeopleContentQueryRequestModel`](../../../lib/core/services/people-content.service.ts) - (Optional) maxItems and skipCount parameters supported by JS-API - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](../../../lib/core/services/people-content.service.ts)`>` - Response containing pagination and list of entries -- **updatePerson**(personId: `string`, details: [`PersonBodyUpdate`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/personBodyUpdate.ts), opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`
+- **resetLocalCurrentUser**()
+ Reset the local current user object +- **updatePerson**(personId: `string`, details: `PersonBodyUpdate`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`
Updates the person details - _personId:_ `string` - The identifier of a person - - _details:_ [`PersonBodyUpdate`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/personBodyUpdate.ts) - The person details + - _details:_ `PersonBodyUpdate` - The person details - _opts:_ `any` - (Optional) Optional parameters - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - Updated person model diff --git a/docs/core/services/renditions.service.md b/docs/core/services/renditions.service.md index f3f4220c86..39349b069d 100644 --- a/docs/core/services/renditions.service.md +++ b/docs/core/services/renditions.service.md @@ -20,11 +20,11 @@ Manages prearranged conversions of content to different formats. - _pollingInterval:_ `number` - Time interval (in milliseconds) between checks for completion - _retries:_ `number` - Number of attempts to make before declaring failure - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md)`>` - True if the rendition was created, false otherwise -- **createRendition**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<__type>`
+- **createRendition**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Creates a rendition for a node. - _nodeId:_ `string` - ID of the target node - _encoding:_ `string` - Name of the rendition encoding - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<__type>` - Null response to indicate completion + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - Null response to indicate completion - **generateRenditionForNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Generates a rendition for a node using the first available encoding. - _nodeId:_ `string` - ID of the target node diff --git a/docs/core/services/sites.service.md b/docs/core/services/sites.service.md index 0ca166cc91..78ac43fe45 100644 --- a/docs/core/services/sites.service.md +++ b/docs/core/services/sites.service.md @@ -19,9 +19,9 @@ Accesses and manipulates sites from a Content Services repository. - _inviteeId:_ `string` - The invitee user name. - _opts:_ `any` - (Optional) Options supported by JS-API - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipRequestWithPersonPaging.md)`>` - Null response notifying when the operation is complete -- **createSite**(siteBody: [`SiteBodyCreate`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteBodyCreate.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`>`
+- **createSite**(siteBody: `SiteBodyCreate`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`>`
Create a site - - _siteBody:_ [`SiteBodyCreate`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteBodyCreate.ts) - [SiteBodyCreate](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteBodyCreate.ts) to create site + - _siteBody:_ `SiteBodyCreate` - SiteBodyCreate to create site - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`>` - site SiteEntry - **createSiteGroupMembership**(siteId: `string`, siteMembershipBodyCreate: [`SiteMembershipBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipBodyCreate.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteGroupEntry.md)`>`
Create a site membership for group @@ -52,24 +52,24 @@ Accesses and manipulates sites from a Content Services repository. - **getEcmCurrentLoggedUserName**(): `string`
Gets the username of the user currently logged into ACS. - **Returns** `string` - Username string -- **getSite**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`
+- **getSite**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>`
Gets the details for a site. - _siteId:_ `string` - ID of the target site - _opts:_ `any` - (Optional) Options supported by JS-API - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Information about the site -- **getSiteContent**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>` - Information about the site +- **getSiteContent**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>`
Gets a site's content. - _siteId:_ `string` - ID of the target site - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site content + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>` - Site content - **getSiteGroupMembership**(siteId: `string`, groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteGroupEntry.md)`>`
Get information about site membership of group - _siteId:_ `string` - The identifier of a site. - _groupId:_ `string` - The authorityId of a group. - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteGroupEntry.md)`>` - [Observable](http://reactivex.io/documentation/observable.html)<SiteGroupEntry> -- **getSiteMembers**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`
+- **getSiteMembers**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>`
Gets a list of all a site's members. - _siteId:_ `string` - ID of the target site - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site members + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|any>` - Site members - **getSiteMembershipRequests**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMembershipRequestWithPersonPaging.md)`>`
Gets a list of site membership requests. - _opts:_ `any` - (Optional) Options supported by JS-API @@ -82,11 +82,11 @@ Accesses and manipulates sites from a Content Services repository. Gets a list of all sites in the repository. - _opts:_ `any` - Options supported by JS-API - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md)`>` - List of sites -- **listSiteGroups**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupPaging.ts)`>`
+- **listSiteGroups**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
List group membership for site - _siteId:_ `string` - The identifier of a site. - _opts:_ `any` - (Optional) Options supported by JS-API - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupPaging`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupPaging.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)<SiteGroupPaging> + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - [`Observable`](http://reactivex.io/documentation/observable.html)<SiteGroupPaging> - **listSiteMemberships**(siteId: `string`, opts: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberPaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/SiteMemberPaging.md)`>`
Gets a list of all a site's members. - _siteId:_ `string` - ID of the target site diff --git a/docs/core/services/translation.service.md b/docs/core/services/translation.service.md index 884a07958b..467be17384 100644 --- a/docs/core/services/translation.service.md +++ b/docs/core/services/translation.service.md @@ -17,15 +17,15 @@ Supports localisation. Adds a new folder of translation source files. - _name:_ `string` - Name for the translation provider - _path:_ `string` - Path to the folder -- **get**(key: `string|Array`, interpolateParams?: `Object`): [`Observable`](http://reactivex.io/documentation/observable.html)``
+- **get**(key: `string|Array`, interpolateParams?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Gets the translation for the supplied key. - _key:_ `string|Array` - Key to translate - - _interpolateParams:_ `Object` - (Optional) String(s) to be interpolated into the main message + - _interpolateParams:_ `any` - (Optional) String(s) to be interpolated into the main message - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - Translated text -- **instant**(key: `string|Array`, interpolateParams?: `Object`): `string|any`
+- **instant**(key: `string|Array`, interpolateParams?: `any`): `string|any`
Directly returns the translation for the supplied key. - _key:_ `string|Array` - Key to translate - - _interpolateParams:_ `Object` - (Optional) String(s) to be interpolated into the main message + - _interpolateParams:_ `any` - (Optional) String(s) to be interpolated into the main message - **Returns** `string|any` - Translated text - **loadTranslation**(lang: `string`, fallback?: `string`)
Loads a translation file. diff --git a/docs/core/services/upload.service.md b/docs/core/services/upload.service.md index 128d570efc..8d302d458d 100644 --- a/docs/core/services/upload.service.md +++ b/docs/core/services/upload.service.md @@ -20,11 +20,16 @@ Provides access to various APIs related to file upload features. - **cancelUpload**(files: [`FileModel`](../../../lib/core/models/file.model.ts)`[]`)
Cancels uploading of files. If the file is smaller than 1 MB the file will be uploaded and then the node deleted to prevent having files that were aborted but still uploaded. - _files:_ [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - One or more separate parameters or an array of files specifying uploads to cancel +- **clearCache**()
+ - **clearQueue**()
Clears the upload queue - **getQueue**(): [`FileModel`](../../../lib/core/models/file.model.ts)`[]`
Gets the file Queue - **Returns** [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - Array of files that form the queue +- **getThreadsCount**(): `number`
+ Returns the number of concurrent threads for uploading. + - **Returns** `number` - Number of concurrent threads (default 1) - **getUploadPromise**(file: [`FileModel`](../../../lib/core/models/file.model.ts)): `any`
Gets an upload promise for a file. - _file:_ [`FileModel`](../../../lib/core/models/file.model.ts) - The target file @@ -122,7 +127,7 @@ It is also possible to provide the `versioningEnabled` value as part of the [`Fi ### Concurrent Uploads -By default, the Upload Service processes one file at a time. +By default, the [Upload Service](../../core/services/upload.service.md) processes one file at a time. You can increase the number of concurrent threads by changing the `upload.threads` configuration parameter: **app.config.json** diff --git a/docs/core/services/user-access.service.md b/docs/core/services/user-access.service.md index 41514d3603..70b376fbdb 100644 --- a/docs/core/services/user-access.service.md +++ b/docs/core/services/user-access.service.md @@ -12,16 +12,18 @@ Checks the global and application access of a user ## Class members ### Methods -- **fetchUserAccess**()
- Fetches the global and application access of the user -- **hasApplicationAccess**(appName: `string`, rolesToCheck: string[]): `boolean`
- Checks if the user has at least one of the roles to check for a given app. - - appName: `string` - The name of the app - - rolesToCheck: `string[]` - The roles to check - - **Returns** `boolean` - True if it contains at least one of the given roles to check for the given app, false otherwise -- **hasGlobalAccess**(rolesToCheck: string[]): `boolean`
- Checks if the user has at least one of the given roles to check in the global roles. - - rolesToCheck: `string[]` - The roles to check - - **Returns** `boolean` - True if it contains at least one of the given roles to check, false otherwise -- **resetAccess**()
- Resets the cached access of the user + +- **fetchUserAccess**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)``
+ Fetches the global and application access of the user + - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`` - +- **hasApplicationAccess**(appName: `string`, rolesToCheck: `string[]`): `boolean`
+ Checks for global roles access. + - _appName:_ `string` - The app name + - _rolesToCheck:_ `string[]` - List of the roles to check + - **Returns** `boolean` - True if it contains at least one of the given roles, false otherwise +- **hasGlobalAccess**(rolesToCheck: `string[]`): `boolean`
+ Checks for global roles access. + - _rolesToCheck:_ `string[]` - List of the roles to check + - **Returns** `boolean` - True if it contains at least one of the given roles, false otherwise +- **resetAccess**()
+ Resets the cached user access diff --git a/docs/extensions/services/extension.service.md b/docs/extensions/services/extension.service.md index c8c5836a8b..905b4fcffb 100644 --- a/docs/extensions/services/extension.service.md +++ b/docs/extensions/services/extension.service.md @@ -22,10 +22,10 @@ Manages and runs basic extension functionality. Retrieves an action using its ID value. - _id:_ `string` - The ID value to look for - **Returns** [`ActionRef`](../../../lib/extensions/src/lib/config/action.extensions.ts) - Action or null if not found -- **getAuthGuards**(ids: `string[]`): `Array>`
+- **getAuthGuards**(ids: `string[]`): `Array>`
Retrieves one or more auth guards using an array of ID values. - _ids:_ `string[]` - Array of ID value to look for - - **Returns** `Array>` - Array of auth guards or empty array if none were found + - **Returns** `Array>` - Array of auth guards or empty array if none were found - **getComponentById**(id: `string`): `Type<>`
Retrieves a registered [extension component](../../../lib/extensions/src/lib/services/component-register.service.ts) using its ID value. - _id:_ `string` - The ID value to look for @@ -55,11 +55,11 @@ Manages and runs basic extension functionality. - **load**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>`
Loads and registers an extension config file and plugins (specified by path properties). - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>` - The loaded config data -- **runExpression**(value: `string|__type`, context?: `any`): `Function`
+- **runExpression**(value: `string|any`, context?: `any`): `any`
Runs a lightweight expression stored in a string. - - _value:_ `string|__type` - String containing the expression or literal value + - _value:_ `string|any` - String containing the expression or literal value - _context:_ `any` - (Optional) Parameter object for the expression with details of app state - - **Returns** `Function` - Result of evaluated expression, if found, or the literal value otherwise + - **Returns** `any` - Result of evaluated expression, if found, or the literal value otherwise - **setAuthGuards**(values: `Function`)
Adds one or more new auth guards to the existing set. - _values:_ `Function` - The new auth guards to add diff --git a/docs/insights/components/analytics-report-list.component.md b/docs/insights/components/analytics-report-list.component.md index 98e96f47cb..0c46f5a9d0 100644 --- a/docs/insights/components/analytics-report-list.component.md +++ b/docs/insights/components/analytics-report-list.component.md @@ -23,7 +23,7 @@ Shows a list of all available reports | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | | appId | `number` | | appId ID of the target app. | -| layoutType | `string` | | layout Type LIST or GRID. | +| layoutType | `string` | LAYOUT_LIST | layout Type LIST or GRID. | | selectFirst | `boolean` | false | selectFirst. | ### Events diff --git a/docs/process-services-cloud/components/app-list-cloud.component.md b/docs/process-services-cloud/components/app-list-cloud.component.md index 490ae0f84d..c2e405fd08 100644 --- a/docs/process-services-cloud/components/app-list-cloud.component.md +++ b/docs/process-services-cloud/components/app-list-cloud.component.md @@ -47,7 +47,7 @@ For example : | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | -| layoutType | `string` | | (**required**) Defines the layout of the apps. There are two possible values, "GRID" and "LIST". | +| layoutType | `string` | LAYOUT_GRID | (**required**) Defines the layout of the apps. There are two possible values, "GRID" and "LIST". | ### Events diff --git a/docs/process-services-cloud/components/edit-process-filter-cloud.component.md b/docs/process-services-cloud/components/edit-process-filter-cloud.component.md index 496cbbae5a..71a6b887b3 100644 --- a/docs/process-services-cloud/components/edit-process-filter-cloud.component.md +++ b/docs/process-services-cloud/components/edit-process-filter-cloud.component.md @@ -43,7 +43,7 @@ Shows/edits process filter details. | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | -| actions | `string[]` | | List of sort actions. | +| actions | `string[]` | DEFAULT_ACTIONS | List of sort actions. | | appName | `string` | "" | The name of the application. | | filterProperties | `string[]` | | List of process filter properties to display | | id | `string` | | Id of the process instance filter. | diff --git a/docs/process-services-cloud/components/group-cloud.component.md b/docs/process-services-cloud/components/group-cloud.component.md index 0303b10ba4..1670f0069b 100644 --- a/docs/process-services-cloud/components/group-cloud.component.md +++ b/docs/process-services-cloud/components/group-cloud.component.md @@ -46,7 +46,7 @@ Searches Groups. | roles | `string[]` | \[] | Role names of the groups to be listed. | | searchGroupsControl | `FormControl` | | FormControl to search the group | | title | `string` | | Title of the field | -| validate | `boolean` | false | This flag enables the validation on the preSelectGroups passed as input. In case the flag is true the components call the [identity service](../../../lib/testing/src/lib/core/actions/identity/identity.service.ts) to verify the validity of the information passed as input. Otherwise, no check will be done. | +| validate | `boolean` | false | This flag enables the validation on the preSelectGroups passed as input. In case the flag is true the components call the identity service to verify the validity of the information passed as input. Otherwise, no check will be done. | ### Events diff --git a/docs/process-services-cloud/components/people-cloud.component.md b/docs/process-services-cloud/components/people-cloud.component.md index f904d67e7b..23e7c7c182 100644 --- a/docs/process-services-cloud/components/people-cloud.component.md +++ b/docs/process-services-cloud/components/people-cloud.component.md @@ -36,7 +36,7 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu | searchUserCtrl | `FormControl` | | FormControl to search the user | | title | `string` | | Placeholder translation key | | userChipsCtrl | `FormControl` | | FormControl to list of users | -| validate | `boolean` | false | This flag enables the validation on the preSelectUsers passed as input. In case the flag is true the components call the [identity service](../../../lib/testing/src/lib/core/actions/identity/identity.service.ts) to verify the validity of the information passed as input. Otherwise, no check will be done. | +| validate | `boolean` | false | This flag enables the validation on the preSelectUsers passed as input. In case the flag is true the components call the identity service to verify the validity of the information passed as input. Otherwise, no check will be done. | ### Events diff --git a/docs/process-services-cloud/components/process-list-cloud.component.md b/docs/process-services-cloud/components/process-list-cloud.component.md index 35967dd988..8e8e8e7339 100644 --- a/docs/process-services-cloud/components/process-list-cloud.component.md +++ b/docs/process-services-cloud/components/process-list-cloud.component.md @@ -70,6 +70,7 @@ when the process list is empty: | selectionMode | `string` | "single" | Row selection mode. Can be "none", "single" or "multiple". For multiple mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | showActions | `boolean` | false | Toggles the data actions column. | | showContextMenu | `boolean` | false | Toggles custom context menu for the component. | +| showMainDatatableActions | `boolean` | false | Toggle main datatable actions. | | sorting | [`ProcessListCloudSortingModel`](../../../lib/process-services-cloud/src/lib/process/process-list/models/process-list-sorting.model.ts)`[]` | | Array of objects specifying the sort order and direction for the list. The sort parameters are for BE sorting. | | startFrom | `string` | "" | Filter the processes. Display only process with startedDate greater then the supplied date. | | startTo | `string` | "" | Filter the processes. Display only process with startedDate less than the supplied date. | diff --git a/docs/process-services-cloud/components/start-process-cloud.component.md b/docs/process-services-cloud/components/start-process-cloud.component.md index c709b33eb1..756df6d784 100644 --- a/docs/process-services-cloud/components/start-process-cloud.component.md +++ b/docs/process-services-cloud/components/start-process-cloud.component.md @@ -37,12 +37,13 @@ Starts a process. | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | | appName | `string` | "" | (required) Name of the app. | -| maxNameLength | `number` | | Maximum length of the process name. | +| maxNameLength | `number` | MAX_NAME_LENGTH | Maximum length of the process name. | | name | `string` | "" | Name of the process. | | processDefinitionName | `string` | | Name of the process definition. | | showSelectProcessDropdown | `boolean` | true | Show/hide the process dropdown list. | +| showTitle | `boolean` | true | Show/hide title. | | values | [`TaskVariableCloud`](../../../lib/process-services-cloud/src/lib/form/models/task-variable-cloud.model.ts)`[]` | | Parameter to pass form field values in the start form if one is associated. | -| variables | `__type` | | Variables to attach to the payload. | +| variables | `any` | | Variables to attach to the payload. | ### Events diff --git a/docs/process-services-cloud/components/start-task-cloud.component.md b/docs/process-services-cloud/components/start-task-cloud.component.md index ba2c013821..f0b6530723 100644 --- a/docs/process-services-cloud/components/start-task-cloud.component.md +++ b/docs/process-services-cloud/components/start-task-cloud.component.md @@ -26,7 +26,7 @@ Creates/starts a new task for the specified app. | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | | appName | `string` | "" | (required) Name of the app. | -| maxNameLength | `number` | | Maximum length of the task name. | +| maxNameLength | `number` | MAX_NAME_LENGTH | Maximum length of the task name. | | name | `string` | "" | Name of the task. | ### Events diff --git a/docs/process-services-cloud/components/task-list-cloud.component.md b/docs/process-services-cloud/components/task-list-cloud.component.md index 209f909a7a..9e8789ddb2 100644 --- a/docs/process-services-cloud/components/task-list-cloud.component.md +++ b/docs/process-services-cloud/components/task-list-cloud.component.md @@ -80,7 +80,8 @@ when the task list is empty: | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use the Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | showActions | `boolean` | false | Toggles the data actions column. | | showContextMenu | `boolean` | false | Toggles custom context menu for the component. | -| sorting | [`TaskListCloudSortingModel`](../../../lib/process-services-cloud/src/lib/task/task-list/models/task-list-sorting.model.ts)`[]` | | Specifies how the table should be sorted. The parameters are for BE sorting. | +| showMainDatatableActions | `boolean` | false | Toggles main datatable actions. | +| sorting | [`TaskListCloudSortingModel`](../../../lib/process-services-cloud/src/lib/models/task-list-sorting.model.ts)`[]` | | Specifies how the table should be sorted. The parameters are for BE sorting. | | standalone | `boolean` | false | Filter the tasks. Display only the tasks that belong to a process in case is false or tasks that doesn't belong to a process in case of true. | | status | `string` | "" | Filter the tasks. Display only tasks with status equal to the supplied value. | | stickyHeader | `boolean` | false | Toggles the sticky header mode. | diff --git a/docs/process-services-cloud/services/process-filter-cloud.service.md b/docs/process-services-cloud/services/process-filter-cloud.service.md index f30a0ee44f..8577b273a2 100644 --- a/docs/process-services-cloud/services/process-filter-cloud.service.md +++ b/docs/process-services-cloud/services/process-filter-cloud.service.md @@ -34,22 +34,22 @@ Manage Process Filters, which are pre-configured Process Instance queries. Checks if given filter is a default filter - _filterName:_ `string` - Name of the target process filter - **Returns** `boolean` - Boolean value for whether the filter is a default filter -- **readQueryParams**(obj: `Object`): [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)
+- **readQueryParams**(obj: `any`): [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)
- - _obj:_ `Object` - + - _obj:_ `any` - - **Returns** [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts) - - **updateFilter**(updatedFilter: [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`[]>`
Update process instance filter - _updatedFilter:_ [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts) - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`[]>` - Observable of process instance filters with updated filter -- **writeQueryParams**(value: `Object`, filterProperties: `string[]`, appName?: `string`, id?: `string`): `Object`
+- **writeQueryParams**(value: `any`, filterProperties: `string[]`, appName?: `string`, id?: `string`): `any`
- - _value:_ `Object` - + - _value:_ `any` - - _filterProperties:_ `string[]` - - _appName:_ `string` - (Optional) - _id:_ `string` - (Optional) - - **Returns** `Object` - + - **Returns** `any` - ## Inject Preference service diff --git a/docs/process-services-cloud/services/start-process-cloud.service.md b/docs/process-services-cloud/services/start-process-cloud.service.md index ff891513c6..19b247e234 100644 --- a/docs/process-services-cloud/services/start-process-cloud.service.md +++ b/docs/process-services-cloud/services/start-process-cloud.service.md @@ -15,12 +15,12 @@ Gets process definitions and starts processes. - **createProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`
Create a process based on a process definition, name, form values or variables. - - _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts) + - _appName:_ `string` - name of the Application - _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc) - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just created - **deleteProcess**(appName: `string`, processInstanceId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Delete an existing process instance - - _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts) + - _appName:_ `string` - name of the Application - _processInstanceId:_ `string` - process instance to update - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - - **getBasePath**(appName: `string`): `string`
@@ -28,10 +28,16 @@ Gets process definitions and starts processes. - _appName:_ `string` - - **Returns** `string` - -- **getProcessDefinitions**(appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>`
+- **getProcessDefinitions**(appName: `string`, queryParams?: `Function`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>`
Gets the process definitions associated with an app. - _appName:_ `string` - Name of the target app + - _queryParams:_ `Function` - (Optional) - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>` - Array of process definitions +- **getStartEventFormStaticValuesMapping**(appName: `string`, processDefinitionId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskVariableCloud`](../../../lib/process-services-cloud/src/lib/form/models/task-variable-cloud.model.ts)`[]>`
+ Gets the static values mapped to the start form of a process definition. + - _appName:_ `string` - Name of the app + - _processDefinitionId:_ `string` - ID of the target process definition + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskVariableCloud`](../../../lib/process-services-cloud/src/lib/form/models/task-variable-cloud.model.ts)`[]>` - Static mappings for the start event - **startCreatedProcess**(appName: `string`, createdProcessInstanceId: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`
Starts an already created process using the process instance id. - _appName:_ `string` - @@ -40,12 +46,12 @@ Gets process definitions and starts processes. - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started - **startProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`
Starts a process based on a process definition, name, form values or variables. - - _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts) + - _appName:_ `string` - name of the Application - _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc) - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started - **updateProcess**(appName: `string`, processInstanceId: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`
Update an existing process instance - - _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts) + - _appName:_ `string` - name of the Application - _processInstanceId:_ `string` - process instance to update - _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc) - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started diff --git a/docs/process-services-cloud/services/task-list-cloud.service.md b/docs/process-services-cloud/services/task-list-cloud.service.md index c6f84f0218..6bec7fc8fe 100644 --- a/docs/process-services-cloud/services/task-list-cloud.service.md +++ b/docs/process-services-cloud/services/task-list-cloud.service.md @@ -18,14 +18,14 @@ Searches tasks. - _appName:_ `string` - - **Returns** `string` - -- **getTaskByRequest**(requestNode: [`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/task-list/models/filter-cloud-model.ts), queryUrl?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
+- **getTaskByRequest**(requestNode: [`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/models/filter-cloud-model.ts), queryUrl?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Finds a task using an object with optional query properties. - - _requestNode:_ [`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/task-list/models/filter-cloud-model.ts) - Query object + - _requestNode:_ [`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/models/filter-cloud-model.ts) - Query object - _queryUrl:_ `string` - (Optional) Query url - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - Task information ## Details Note that for a call to `getTaskByRequest`, the -[`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/task-list/models/filter-cloud-model.ts) object +[`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/models/filter-cloud-model.ts) object must at minimum have the `appName` property correctly set. diff --git a/docs/process-services/components/process-list.component.md b/docs/process-services/components/process-list.component.md index 8a2d12fa9b..c4d73ee8d1 100644 --- a/docs/process-services/components/process-list.component.md +++ b/docs/process-services/components/process-list.component.md @@ -56,7 +56,7 @@ when the process list is empty: | multiselect | `boolean` | false | Toggles multiple row selection, which renders checkboxes at the beginning of each row | | page | `number` | 0 | The page number of the processes to fetch. | | presetColumn | `string` | | Custom preset column schema in JSON format. | -| processDefinitionId | `string` | | The [Definition](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/definition.ts) Id of the process. | +| processDefinitionId | `string` | | The Definition Id of the process. | | processInstanceId | `number \| string` | | The id of the process instance. | | resolverFn | `Function` | null | Resolver function is used to show dynamic complex column objects see the docs to learn how to configure a resolverFn. | | selectFirstRow | `boolean` | true | Toggles default selection of the first row | diff --git a/docs/process-services/components/start-process.component.md b/docs/process-services/components/start-process.component.md index b0d992f5a7..1f951ec6c7 100644 --- a/docs/process-services/components/start-process.component.md +++ b/docs/process-services/components/start-process.component.md @@ -42,7 +42,7 @@ Starts a process. | ---- | ---- | ------------- | ----------- | | appId | `number` | | (optional) Limit the list of processes that can be started to those contained in the specified app. | | name | `string` | "" | (optional) Name to assign to the current process. | -| processDefinitionName | `string` | | (optional) [Definition](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/definition.ts) name of the process to start. | +| processDefinitionName | `string` | | (optional) Definition name of the process to start. | | processFilterSelector | `boolean` | true | (optional) Parameter to enable selection of process when filtering. | | showSelectApplicationDropdown | `boolean` | false | (optional) Hide or show application selection dropdown. | | showSelectProcessDropdown | `boolean` | true | Hide or show the process selection dropdown. | diff --git a/docs/process-services/components/task-list.component.md b/docs/process-services/components/task-list.component.md index 7d065d1b62..a7ac8f3aa4 100644 --- a/docs/process-services/components/task-list.component.md +++ b/docs/process-services/components/task-list.component.md @@ -64,7 +64,7 @@ when the task list is empty: | name | `string` | | Name of the tasklist. | | page | `number` | 0 | The page number of the tasks to fetch. | | presetColumn | `string` | | Custom preset column schema in JSON format. | -| processDefinitionId | `string` | | The [Definition](../../../lib/cli/node_modules/@alfresco/js-api/src/api/content-rest-api/model/definition.ts) Id of the process. | +| processDefinitionId | `string` | | The Definition Id of the process. | | processInstanceId | `string` | | The Instance Id of the process. | | selectFirstRow | `boolean` | true | Toggles default selection of the first row | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | diff --git a/lib/core/datatable/components/columns-selector/columns-selector.component.spec.ts b/lib/core/datatable/components/columns-selector/columns-selector.component.spec.ts index ffdc543f91..e78331918a 100644 --- a/lib/core/datatable/components/columns-selector/columns-selector.component.spec.ts +++ b/lib/core/datatable/components/columns-selector/columns-selector.component.spec.ts @@ -149,7 +149,7 @@ describe('ColumnsSelectorComponent', () => { const firstColumnCheckbox = await loader.getHarness(MatCheckboxHarness); const checkBoxName = await firstColumnCheckbox.getLabelText(); - let toggledColumnItem = component.columnItems.find(item => item.title === checkBoxName); + const toggledColumnItem = component.columnItems.find(item => item.title === checkBoxName); expect(toggledColumnItem.isHidden).toBeFalsy(); await firstColumnCheckbox.toggle(); diff --git a/lib/core/mock/ecm-user.service.mock.ts b/lib/core/mock/ecm-user.service.mock.ts index a488716d62..2c93f26948 100644 --- a/lib/core/mock/ecm-user.service.mock.ts +++ b/lib/core/mock/ecm-user.service.mock.ts @@ -17,7 +17,6 @@ import { EcmCompanyModel } from '../models/ecm-company.model'; import { PersonEntry, Person, PersonPaging } from '@alfresco/js-api'; -import { EcmUserModel } from '../models'; export const fakeEcmCompany: EcmCompanyModel = { organization: 'company-fake-name', @@ -30,7 +29,7 @@ export const fakeEcmCompany: EcmCompanyModel = { email: 'fakeCompany@fake.com' }; -export const fakeEcmUser = new EcmUserModel({ +export const fakeEcmUser = { id: 'fake-id', firstName: 'fake-ecm-first-name', lastName: 'fake-ecm-last-name', @@ -49,7 +48,14 @@ export const fakeEcmUser = new EcmUserModel({ userStatus: 'active', enabled: true, emailNotificationsEnabled: true -}); +}; + +export const fakeEcmAdminUser = { + ...fakeEcmUser, + capabilities: { + isAdmin: true + } +}; export const fakeEcmUser2 = { id: 'another-fake-id', diff --git a/lib/core/models/ecm-user.model.ts b/lib/core/models/ecm-user.model.ts index df301d5fd4..ce2c27a2b5 100644 --- a/lib/core/models/ecm-user.model.ts +++ b/lib/core/models/ecm-user.model.ts @@ -65,4 +65,8 @@ export class EcmUserModel { this.properties = obj && obj.properties; this.capabilities = obj && obj.capabilities; } + + isAdmin(): boolean { + return this.capabilities?.isAdmin; + } } diff --git a/lib/core/services/auth-guard-sso-role.service.spec.ts b/lib/core/services/auth-guard-sso-role.service.spec.ts index df8fbdd273..b8f30eb64f 100644 --- a/lib/core/services/auth-guard-sso-role.service.spec.ts +++ b/lib/core/services/auth-guard-sso-role.service.spec.ts @@ -24,10 +24,8 @@ import { JwtHelperService } from './jwt-helper.service'; import { MatDialog } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { PeopleContentService } from './people-content.service'; -import { of } from 'rxjs'; -import { getFakeUserWithContentAdminCapability, getFakeUserWithContentUserCapability } from '../mock/ecm-user.service.mock'; import { UserAccessService } from './user-access.service'; -import { AppConfigService } from '../app-config/app-config.service'; +import { of } from 'rxjs'; describe('Auth Guard SSO role service', () => { @@ -36,7 +34,6 @@ describe('Auth Guard SSO role service', () => { let routerService: Router; let peopleContentService: PeopleContentService; let userAccessService: UserAccessService; - let appConfig: AppConfigService; setupTestBed({ imports: [ @@ -46,8 +43,6 @@ describe('Auth Guard SSO role service', () => { }); beforeEach(() => { - appConfig = TestBed.inject(AppConfigService); - appConfig.config.providers = 'ECM'; localStorage.clear(); authGuard = TestBed.inject(AuthGuardSsoRoleService); jwtHelperService = TestBed.inject(JwtHelperService); @@ -186,76 +181,51 @@ describe('Auth Guard SSO role service', () => { describe('Content Admin', () => { - afterEach(() => { - peopleContentService.hasCheckedIsContentAdmin = false; - }); - it('Should give access to a content section (ALFRESCO_ADMINISTRATORS) when the user has content admin capability', async () => { - spyOn(peopleContentService, 'getCurrentPerson').and.returnValue(of(getFakeUserWithContentAdminCapability())); + spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({})); + spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(true); + spyUserAccess([], {}); + const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - expect(await authGuard.canActivate(router)).toBeTruthy(); + expect(await authGuard.canActivate(router)).toBe(true); }); it('Should not give access to a content section (ALFRESCO_ADMINISTRATORS) when the user does not have content admin capability', async () => { - spyOn(peopleContentService, 'getCurrentPerson').and.returnValue(of(getFakeUserWithContentUserCapability())); + spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({})); + spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(false); + spyUserAccess([], {}); + const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - expect(await authGuard.canActivate(router)).toBeFalsy(); + expect(await authGuard.canActivate(router)).toBe(false); }); it('Should not call the service to check if the user has content admin capability when the roles do not contain ALFRESCO_ADMINISTRATORS', async () => { - const getCurrentPersonSpy = spyOn(peopleContentService, 'getCurrentPerson').and.returnValue(of(getFakeUserWithContentAdminCapability())); + const isCurrentAdminSpy = spyOn(peopleContentService, 'isCurrentUserAdmin').and.stub(); spyUserAccess([], {}); + const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); router.data = { roles: ['fakeRole'] }; await authGuard.canActivate(router); - expect(getCurrentPersonSpy).not.toHaveBeenCalled(); - }); - - it('Should not retrieve the user when the provider is BPM', async () => { - spyUserAccess([], {}); - spyOn(peopleContentService, 'getCurrentPerson'); - appConfig.config.providers = 'BPM'; - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - - const result = await authGuard.canActivate(router); - - expect(result).toBeFalsy(); - expect(peopleContentService.getCurrentPerson).not.toHaveBeenCalled(); - }); - - it('Should not fail when the people service throws an error', async () => { - spyUserAccess([], {}); - spyOn(peopleContentService, 'getCurrentPerson').and.throwError('404 Not found'); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - - const result = await authGuard.canActivate(router); - - expect(result).toBeFalsy(); - expect(peopleContentService.getCurrentPerson).toHaveBeenCalled(); + expect(isCurrentAdminSpy).not.toHaveBeenCalled(); }); }); describe('Excluded Roles', () => { it('Should canActivate be false when the user has one of the excluded roles', async () => { - spyOn(peopleContentService, 'getCurrentPerson').and.returnValue(of(getFakeUserWithContentAdminCapability())); spyUserAccess(['MOCK_USER_ROLE'], {}); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'], excludedRoles: ['MOCK_USER_ROLE'] }; + router.data = { roles: ['MOCK_ANOTHER_ROLE'], excludedRoles: ['MOCK_USER_ROLE'] }; - expect(await authGuard.canActivate(router)).toBeFalsy(); + expect(await authGuard.canActivate(router)).toBe(false); }); it('Should canActivate be true when the user has none of the excluded roles', async () => { @@ -263,18 +233,31 @@ describe('Auth Guard SSO role service', () => { const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); router.data = { roles: ['MOCK_USER_ROLE', 'MOCK_ADMIN_ROLE'], excludedRoles: ['MOCK_ROOT_USER_ROLE'] }; - - expect(await authGuard.canActivate(router)).toBeTruthy(); + const result = await authGuard.canActivate(router); + expect(result).toBeTruthy(); }); - it('Should canActivate be false when the user is a content admin and the ALFRESCO_ADMINISTRATORS role is excluded', async () => { - spyOn(peopleContentService, 'getCurrentPerson').and.returnValue(of(getFakeUserWithContentAdminCapability())); + it('Should canActivate be true when the user has none of the excluded role and is not a content admin', async () => { + spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({})); + spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(false); spyUserAccess(['MOCK_USER_ROLE'], {}); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); router.data = { roles: ['MOCK_USER_ROLE'], excludedRoles: ['ALFRESCO_ADMINISTRATORS'] }; - expect(await authGuard.canActivate(router)).toBeFalsy(); + expect(await authGuard.canActivate(router)).toBe(true); + }); + + it('Should canActivate be false if the user is a content admin but has one of the excluded roles', async () => { + const isCurrentAdminSpy = spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({})); + spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(true); + spyUserAccess(['MOCK_USER_ROLE'], {}); + + const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); + router.data = { roles: ['ALFRESCO_ADMINISTRATORS'], excludedRoles: ['MOCK_USER_ROLE'] }; + + expect(await authGuard.canActivate(router)).toBe(false); + expect(isCurrentAdminSpy).toHaveBeenCalled(); }); }); }); diff --git a/lib/core/services/auth-guard-sso-role.service.ts b/lib/core/services/auth-guard-sso-role.service.ts index f73b7b7c33..a023036115 100644 --- a/lib/core/services/auth-guard-sso-role.service.ts +++ b/lib/core/services/auth-guard-sso-role.service.ts @@ -20,7 +20,6 @@ import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router'; import { MatDialog } from '@angular/material/dialog'; import { ContentGroups, PeopleContentService } from './people-content.service'; import { UserAccessService } from './user-access.service'; -import { AppConfigService } from '../app-config/app-config.service'; @Injectable({ providedIn: 'root' @@ -29,15 +28,13 @@ export class AuthGuardSsoRoleService implements CanActivate { constructor(private userAccessService: UserAccessService, private router: Router, private dialog: MatDialog, - private peopleContentService: PeopleContentService, - private appConfig: AppConfigService) { + private peopleContentService: PeopleContentService) { } async canActivate(route: ActivatedRouteSnapshot): Promise { await this.userAccessService.fetchUserAccess(); let hasRealmRole = false; let hasClientRole = true; - if (route.data) { if (route.data['roles']) { const rolesToCheck: string[] = route.data['roles']; @@ -45,11 +42,7 @@ export class AuthGuardSsoRoleService implements CanActivate { hasRealmRole = true; } else { const excludedRoles = route.data['excludedRoles'] || []; - let isContentAdmin = false; - if (this.checkContentAdministratorRole(rolesToCheck, excludedRoles)) { - isContentAdmin = await this.peopleContentService.isContentAdmin().catch(() => false); - } - hasRealmRole = excludedRoles.length ? this.checkAccessWithExcludedRoles(rolesToCheck, excludedRoles, isContentAdmin) : this.hasRoles(rolesToCheck, isContentAdmin); + hasRealmRole = await this.validateRoles(rolesToCheck, excludedRoles); } } @@ -59,7 +52,6 @@ export class AuthGuardSsoRoleService implements CanActivate { hasClientRole = this.userAccessService.hasApplicationAccess(clientRoleName, rolesToCheck); } } - const hasRole = hasRealmRole && hasClientRole; if (!hasRole && route?.data && route.data['redirectUrl']) { @@ -73,19 +65,23 @@ export class AuthGuardSsoRoleService implements CanActivate { return hasRole; } - private checkContentAdministratorRole(rolesToCheck: string[], excludedRoles: string[]): boolean { - const hasContentProvider = this.appConfig.config.providers === 'ECM' || this.appConfig.config.providers === 'ALL'; - const checkAdminRole = rolesToCheck.includes(ContentGroups.ALFRESCO_ADMINISTRATORS) || excludedRoles.includes(ContentGroups.ALFRESCO_ADMINISTRATORS); - return hasContentProvider && checkAdminRole; + private async validateRoles(rolesToCheck: string[], excludedRoles?: string[]): Promise { + if (excludedRoles?.length > 0) { + return await this.hasRoles(rolesToCheck) && !await this.hasRoles(excludedRoles); + } + return this.hasRoles(rolesToCheck); } - private checkAccessWithExcludedRoles(rolesToCheck: string[], excludedRoles: string[], isContentAdmin: boolean): boolean { - return this.hasRoles(rolesToCheck, isContentAdmin) && !this.hasRoles(excludedRoles, isContentAdmin); + private async hasRoles(roles: string[] = []): Promise { + if (this.containsAlfrescoAdminRole(roles)) { + await this.peopleContentService.getCurrentUserInfo().toPromise(); + return this.peopleContentService.isCurrentUserAdmin() || this.userAccessService.hasGlobalAccess(roles); + } + return this.userAccessService.hasGlobalAccess(roles); } - private hasRoles(rolesToCheck: string[], isContentAdmin: boolean): boolean { - return rolesToCheck.includes(ContentGroups.ALFRESCO_ADMINISTRATORS) - ? this.userAccessService.hasGlobalAccess(rolesToCheck) || isContentAdmin - : this.userAccessService.hasGlobalAccess(rolesToCheck); + private containsAlfrescoAdminRole(roles: string []): boolean { + return roles.includes(ContentGroups.ALFRESCO_ADMINISTRATORS); } + } diff --git a/lib/core/services/people-content.service.spec.ts b/lib/core/services/people-content.service.spec.ts index 32416a5cef..702e21bd82 100644 --- a/lib/core/services/people-content.service.spec.ts +++ b/lib/core/services/people-content.service.spec.ts @@ -15,16 +15,16 @@ * limitations under the License. */ -import { fakeEcmUser, fakeEcmUserList, createNewPersonMock, getFakeUserWithContentAdminCapability } from '../mock/ecm-user.service.mock'; +import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmAdminUser } from '../mock/ecm-user.service.mock'; import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; import { CoreTestingModule } from '../testing/core.testing.module'; -import { PeopleContentService, PeopleContentQueryResponse, PeopleContentQueryRequestModel } from './people-content.service'; +import { PeopleContentService, PeopleContentQueryRequestModel } from './people-content.service'; import { AlfrescoApiService } from './alfresco-api.service'; import { TranslateModule } from '@ngx-translate/core'; import { TestBed } from '@angular/core/testing'; import { LogService } from './log.service'; -import { PersonEntry } from '@alfresco/js-api'; import { AuthenticationService } from './authentication.service'; +import { of } from 'rxjs'; describe('PeopleContentService', () => { @@ -48,58 +48,31 @@ describe('PeopleContentService', () => { logService = TestBed.inject(LogService); }); - it('should be able to fetch person details based on id', (done) => { - spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser }))); - peopleContentService.getPerson('fake-id').subscribe((person) => { - expect(person.entry.id).toEqual('fake-id'); - expect(person.entry.email).toEqual('fakeEcm@ecmUser.com'); - done(); - }); + it('should be able to fetch person details based on id', async () => { + spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(of({entry: fakeEcmUser })); + const person = await peopleContentService.getPerson('fake-id').toPromise(); + expect(person.id).toEqual('fake-id'); + expect(person.email).toEqual('fakeEcm@ecmUser.com'); }); - it('calls getPerson api method by an id', (done) => { - const getPersonSpy = spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(null)); - peopleContentService.getPerson('fake-id').subscribe(() => { - expect(getPersonSpy).toHaveBeenCalledWith('fake-id'); - done(); - }); - }); + it('should be able to list people', async () => { + spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(of(fakeEcmUserList)); + const response = await peopleContentService.listPeople().toPromise(); + const people = response.entries; + const pagination = response.pagination; - it('calls getPerson api method with "-me-"', (done) => { - const getPersonSpy = spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(null)); - peopleContentService.getPerson('-me-').subscribe(() => { - expect(getPersonSpy).toHaveBeenCalledWith('-me-'); - done(); - }); - }); + expect(people).toBeDefined(); + expect(people[0].id).toEqual('fake-id'); + expect(people[1].id).toEqual('another-fake-id'); + expect(pagination.count).toEqual(2); + expect(pagination.totalItems).toEqual(2); + expect(pagination.hasMoreItems).toBeFalsy(); + expect(pagination.skipCount).toEqual(0); - it('should be able to list people', (done) => { - spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(Promise.resolve(fakeEcmUserList)); - peopleContentService.listPeople().subscribe((response: PeopleContentQueryResponse) => { - const people = response.entries; - const pagination = response.pagination; - - expect(people).toBeDefined(); - expect(people[0].id).toEqual('fake-id'); - expect(people[1].id).toEqual('another-fake-id'); - expect(pagination.count).toEqual(2); - expect(pagination.totalItems).toEqual(2); - expect(pagination.hasMoreItems).toBeFalsy(); - expect(pagination.skipCount).toEqual(0); - done(); - }); - }); - - it('should call listPeople api method', (done) => { - const listPeopleSpy = spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(Promise.resolve(fakeEcmUserList)); - peopleContentService.listPeople().subscribe(() => { - expect(listPeopleSpy).toHaveBeenCalled(); - done(); - }); }); it('should call listPeople api with requested sorting params', async () => { - const listPeopleSpy = spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(Promise.resolve(fakeEcmUserList)); + const listPeopleSpy = spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(of(fakeEcmUserList)); const requestQueryParams: PeopleContentQueryRequestModel = { skipCount: 10, maxItems: 20, sorting: { orderBy: 'firstName', direction: 'asc' } }; const expectedValue = { skipCount: 10, maxItems: 20, orderBy: ['firstName ASC'] }; @@ -109,7 +82,7 @@ describe('PeopleContentService', () => { }); it('should not call listPeople api with sorting params if sorting is not defined', async () => { - const listPeopleSpy = spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(Promise.resolve(fakeEcmUserList)); + const listPeopleSpy = spyOn(peopleContentService.peopleApi, 'listPeople').and.returnValue(of(fakeEcmUserList)); const requestQueryParams: PeopleContentQueryRequestModel = { skipCount: 10, maxItems: 20, sorting: undefined }; const expectedValue = { skipCount: 10, maxItems: 20 }; @@ -118,60 +91,48 @@ describe('PeopleContentService', () => { expect(listPeopleSpy).toHaveBeenCalledWith(expectedValue); }); - it('should be able to create new person', (done) => { - spyOn(peopleContentService.peopleApi, 'createPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser }))); - peopleContentService.createPerson(createNewPersonMock).subscribe((person) => { - expect(person.id).toEqual('fake-id'); - expect(person.email).toEqual('fakeEcm@ecmUser.com'); - done(); - }); - }); - - it('should be able to call createPerson api with new person details', (done) => { - const createPersonSpy = spyOn(peopleContentService.peopleApi, 'createPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser }))); - peopleContentService.createPerson(createNewPersonMock).subscribe((person) => { - expect(person.id).toEqual('fake-id'); - expect(person.email).toEqual('fakeEcm@ecmUser.com'); - expect(createPersonSpy).toHaveBeenCalledWith(createNewPersonMock, undefined); - done(); - }); + it('should be able to create new person', async () => { + spyOn(peopleContentService.peopleApi, 'createPerson').and.returnValue(of({entry: fakeEcmUser })); + const newUser = await peopleContentService.createPerson(createNewPersonMock).toPromise(); + expect(newUser.id).toEqual('fake-id'); + expect(newUser.email).toEqual('fakeEcm@ecmUser.com'); }); it('should be able to throw an error if createPerson api failed', (done) => { - const createPersonSpy = spyOn(peopleContentService.peopleApi, 'createPerson').and.returnValue(Promise.reject({ message: 'failed to create new person' })); + spyOn(peopleContentService.peopleApi, 'createPerson').and.returnValue(Promise.reject('failed to create new person')); const logErrorSpy = spyOn(logService, 'error'); peopleContentService.createPerson(createNewPersonMock).subscribe( - () => {}, - (error) => { - expect(error).toEqual({ message: 'failed to create new person' }); - expect(createPersonSpy).toHaveBeenCalled(); - expect(logErrorSpy).toHaveBeenCalledWith({ message: 'failed to create new person' }); - done(); - }); + () => {}, + (error) => { + expect(logErrorSpy).toHaveBeenCalledWith('failed to create new person'); + expect(error).toEqual('failed to create new person'); + done(); + } + ); }); it('Should make the api call to check if the user is a content admin only once', async () => { - const getCurrentPersonSpy = spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(getFakeUserWithContentAdminCapability())); + const getCurrentPersonSpy = spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(of({entry: fakeEcmAdminUser})); - expect(await peopleContentService.isContentAdmin()).toBe(true); + const user = await peopleContentService.getCurrentUserInfo().toPromise(); + expect(user.id).toEqual('fake-id'); + expect(peopleContentService.isCurrentUserAdmin()).toBe(true); expect(getCurrentPersonSpy.calls.count()).toEqual(1); - await peopleContentService.isContentAdmin(); + await peopleContentService.getCurrentUserInfo().toPromise(); - expect(await peopleContentService.isContentAdmin()).toBe(true); + expect(await peopleContentService.isCurrentUserAdmin()).toBe(true); expect(getCurrentPersonSpy.calls.count()).toEqual(1); }); it('should reset the admin cache upon logout', async () => { - const getCurrentPersonSpy = spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(getFakeUserWithContentAdminCapability())); + spyOn(peopleContentService.peopleApi, 'getPerson').and.returnValue(of({entry: fakeEcmAdminUser})); - expect(await peopleContentService.isContentAdmin()).toBeTruthy(); - expect(peopleContentService.hasCheckedIsContentAdmin).toBeTruthy(); + const user = await peopleContentService.getCurrentUserInfo().toPromise(); + expect(user.id).toEqual('fake-id'); + expect(peopleContentService.isCurrentUserAdmin()).toBe(true); authenticationService.onLogout.next(true); - expect(peopleContentService.hasCheckedIsContentAdmin).toBeFalsy(); - - expect(await peopleContentService.isContentAdmin()).toBe(true); - expect(getCurrentPersonSpy.calls.count()).toEqual(2); + expect(peopleContentService.isCurrentUserAdmin()).toBe(false); }); }); diff --git a/lib/core/services/people-content.service.ts b/lib/core/services/people-content.service.ts index 4912f0d35d..c9fd86e9e9 100644 --- a/lib/core/services/people-content.service.ts +++ b/lib/core/services/people-content.service.ts @@ -16,13 +16,14 @@ */ import { Injectable } from '@angular/core'; -import { Observable, from, throwError } from 'rxjs'; +import { Observable, from, throwError, of } from 'rxjs'; import { AlfrescoApiService } from './alfresco-api.service'; -import { catchError, map } from 'rxjs/operators'; -import { PersonEntry, PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api'; +import { catchError, map, tap } from 'rxjs/operators'; +import { PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api'; import { EcmUserModel } from '../models/ecm-user.model'; import { LogService } from './log.service'; import { AuthenticationService } from './authentication.service'; +import { ContentService } from './content.service'; // eslint-disable-next-line no-shadow export enum ContentGroups { @@ -49,8 +50,7 @@ export interface PeopleContentQueryRequestModel { providedIn: 'root' }) export class PeopleContentService { - private hasContentAdminRole: boolean = false; - hasCheckedIsContentAdmin: boolean = false; + private currentUser: EcmUserModel; private _peopleApi: PeopleApi; get peopleApi(): PeopleApi { @@ -61,11 +61,11 @@ export class PeopleContentService { constructor( private apiService: AlfrescoApiService, authenticationService: AuthenticationService, - private logService: LogService + private logService: LogService, + private contentService: ContentService ) { authenticationService.onLogout.subscribe(() => { - this.hasCheckedIsContentAdmin = false; - this.hasContentAdminRole = false; + this.resetLocalCurrentUser(); }); } @@ -75,23 +75,46 @@ export class PeopleContentService { * @param personId ID of the target user * @returns User information */ - getPerson(personId: string): Observable { - const promise = this.peopleApi.getPerson(personId); + getPerson(personId: string): Observable { + return from(this.peopleApi.getPerson(personId)) + .pipe( + map((personEntry) => new EcmUserModel(personEntry.entry)), + tap( user => this.currentUser = user), + catchError((error) => this.handleError(error))); + } - return from(promise).pipe( - catchError((error) => this.handleError(error)) - ); + getCurrentPerson(): Observable { + return this.getCurrentUserInfo(); } /** - * Gets information about the user who is currently logged in. + * Gets information about the current user alias -me- * * @returns User information */ - getCurrentPerson(): Observable { + getCurrentUserInfo(): Observable { + if (this.currentUser) { + return of(this.currentUser); + } return this.getPerson('-me-'); } + /** + * Used to know if the current user has the admin capability + * + * @returns true or false + */ + isCurrentUserAdmin(): boolean { + return this.currentUser?.isAdmin() ?? false; + } + + /** + * Reset the local current user object + */ + resetLocalCurrentUser() { + this.currentUser = undefined; + } + /** * Gets a list of people. * @@ -144,13 +167,14 @@ export class PeopleContentService { ); } - async isContentAdmin(): Promise { - if (!this.hasCheckedIsContentAdmin) { - const user: PersonEntry = await this.getCurrentPerson().toPromise(); - this.hasContentAdminRole = user?.entry?.capabilities?.isAdmin; - this.hasCheckedIsContentAdmin = true; - } - return this.hasContentAdminRole; + /** + * Returns a profile image as a URL. + * + * @param avatarId Target avatar + * @returns Image URL + */ + getUserProfileImage(avatarId: string): string { + return this.contentService.getContentUrl(avatarId); } private buildOrderArray(sorting: PeopleContentSortingModel): string[] { diff --git a/lib/core/services/public-api.ts b/lib/core/services/public-api.ts index 77aae5da87..5686741271 100644 --- a/lib/core/services/public-api.ts +++ b/lib/core/services/public-api.ts @@ -70,3 +70,4 @@ export * from './identity-group.interface'; export * from './language-item.interface'; export * from './sort-by-category.service'; export * from './user-access.service'; +export * from './user-info-resolver.service'; diff --git a/lib/core/services/user-info-resolver.service.ts b/lib/core/services/user-info-resolver.service.ts new file mode 100644 index 0000000000..7d5ea7dfb3 --- /dev/null +++ b/lib/core/services/user-info-resolver.service.ts @@ -0,0 +1,41 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Injectable } from '@angular/core'; +import { + Resolve, + ActivatedRouteSnapshot, + RouterStateSnapshot +} from '@angular/router'; +import { EcmUserModel } from '../models/ecm-user.model'; +import { Observable } from 'rxjs'; +import { PeopleContentService } from './people-content.service'; + +@Injectable({ + providedIn: 'root' +}) +export class UserInfoResolverService implements Resolve { + constructor(private peopleContentService: PeopleContentService) {} + + resolve( + _route: ActivatedRouteSnapshot, + _state: RouterStateSnapshot + ): Observable { + return this.peopleContentService.getCurrentUserInfo(); + } + +} diff --git a/lib/core/userinfo/components/user-info.component.spec.ts b/lib/core/userinfo/components/user-info.component.spec.ts index dd846cfef4..2aa709e289 100644 --- a/lib/core/userinfo/components/user-info.component.spec.ts +++ b/lib/core/userinfo/components/user-info.component.spec.ts @@ -17,12 +17,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By, DomSanitizer } from '@angular/platform-browser'; -import { AuthenticationService, ContentService } from '../../services'; +import { AuthenticationService, ContentService, PeopleContentService } from '../../services'; import { InitialUsernamePipe } from '../../pipes'; import { fakeBpmUser } from '../../mock/bpm-user.service.mock'; import { fakeEcmEditedUser, fakeEcmUser, fakeEcmUserNoImage } from '../../mock/ecm-user.service.mock'; import { BpmUserService } from '../../services/bpm-user.service'; -import { EcmUserService } from '../../services/ecm-user.service'; import { IdentityUserService } from '../../services/identity-user.service'; import { BpmUserModel } from '../../models/bpm-user.model'; import { EcmUserModel } from '../../models/ecm-user.model'; @@ -71,7 +70,7 @@ describe('User info component', () => { let element: HTMLElement; let authService: AuthenticationService; let contentService: ContentService; - let ecmUserService: EcmUserService; + let peopleContentService: PeopleContentService; let bpmUserService: BpmUserService; let identityUserService: IdentityUserService; @@ -106,7 +105,7 @@ describe('User info component', () => { element = fixture.nativeElement; authService = TestBed.inject(AuthenticationService); - ecmUserService = TestBed.inject(EcmUserService); + peopleContentService = TestBed.inject(PeopleContentService); bpmUserService = TestBed.inject(BpmUserService); contentService = TestBed.inject(ContentService); identityUserService = TestBed.inject(IdentityUserService); @@ -145,7 +144,7 @@ describe('User info component', () => { isEcmLoggedInStub = spyOn(authService, 'isEcmLoggedIn').and.returnValue(true); isLoggedInStub = spyOn(authService, 'isLoggedIn').and.returnValue(true); isBpmLoggedInStub = spyOn(authService, 'isBpmLoggedIn').and.returnValue(false); - getCurrenEcmtUserInfoStub = spyOn(ecmUserService, 'getCurrentUserInfo').and.returnValue(of(fakeEcmUser)); + getCurrenEcmtUserInfoStub = spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of(fakeEcmUser)); }); describe('ui ', () => { diff --git a/lib/core/userinfo/components/user-info.component.ts b/lib/core/userinfo/components/user-info.component.ts index 3929fc1ab2..297bb0f05c 100644 --- a/lib/core/userinfo/components/user-info.component.ts +++ b/lib/core/userinfo/components/user-info.component.ts @@ -21,10 +21,10 @@ import { BpmUserModel } from '../../models/bpm-user.model'; import { EcmUserModel } from '../../models/ecm-user.model'; import { IdentityUserModel } from '../../models/identity-user.model'; import { BpmUserService } from '../../services/bpm-user.service'; -import { EcmUserService } from '../../services/ecm-user.service'; import { IdentityUserService } from '../../services/identity-user.service'; import { of, Observable, Subject } from 'rxjs'; import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu'; +import { PeopleContentService } from '../../services/people-content.service'; @Component({ selector: 'adf-userinfo', @@ -70,7 +70,7 @@ export class UserInfoComponent implements OnInit, OnDestroy { selectedIndex: number; private destroy$ = new Subject(); - constructor(private ecmUserService: EcmUserService, + constructor(private peopleContentService: PeopleContentService, private bpmUserService: BpmUserService, private identityUserService: IdentityUserService, private authService: AuthenticationService) { @@ -125,7 +125,7 @@ export class UserInfoComponent implements OnInit, OnDestroy { } private loadEcmUserInfo(): void { - this.ecmUser$ = this.ecmUserService.getCurrentUserInfo(); + this.ecmUser$ = this.peopleContentService.getCurrentUserInfo(); } private loadBpmUserInfo() { @@ -153,7 +153,7 @@ export class UserInfoComponent implements OnInit, OnDestroy { } getEcmAvatar(avatarId: any): string { - return this.ecmUserService.getUserProfileImage(avatarId); + return this.peopleContentService.getUserProfileImage(avatarId); } getBpmUserImage(): string {