Fetch the userInfo once loggedIn and expose the capability of admin (#7682)

* Fetch the userInfo once loggedIn and expose the cabilibility of admin

* Rollback method

* Return same use if defined

* Use the same pepleContent service for UserInfoCOmpnent

* Remove useless import

* Use interface

* Use angular resolver instead of guard

* Remove fdescribe

* Fix linting

* Regenerate doc

* Improve doc

* Fix optional

* Fix the unit test

* Fix comment

* Fix lint

* Fix unit

* Add fetch user as part of the ssoGuard

* Fix unit test after fetch

* Add additional unit

* Fix await
This commit is contained in:
Maurizio Vitale 2022-06-27 12:02:01 +01:00 committed by GitHub
parent a30de37a02
commit 28a47e83d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 378 additions and 332 deletions

View File

@ -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) |

View File

@ -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)`<any>` -
- **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)`>`<br/>
- **getAuditApp**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditAppEntry>`<br/>
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)`>`<br/>
- _opts:_ `any` - (Optional) Options.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditAppEntry>` -
- **getAuditApps**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditAppPaging>`<br/>
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)`>`<br/>
- _opts:_ `any` - (Optional) Options.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditAppPaging>` -
- **getAuditEntries**(auditApplicationId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryPaging>`<br/>
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)`>`<br/>
- _opts:_ `any` - (Optional) Options.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryPaging>` -
- **getAuditEntriesForNode**(nodeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryPaging>`<br/>
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)`>`<br/>
- _opts:_ `any` - (Optional) Options.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryPaging>` -
- **getAuditEntry**(auditApplicationId: `string`, auditEntryId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryEntry>`<br/>
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>`<br/>
- _opts:_ `any` - (Optional) Options.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditEntryEntry>` -
- **updateAuditApp**(auditApplicationId: `string`, auditAppBodyUpdate: `boolean`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<AuditApp|any>`<br/>
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)`<AuditApp|any>` -

View File

@ -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`<br/>
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)<br/>
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)

View File

@ -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)`<any>` - 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>`<br/>
- **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>`<br/>
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>`<br/>
- **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>`<br/>
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

View File

@ -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)<br/>
- **getScope**(): `RequestScope`<br/>
- **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)`[]`<br/>
@ -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))<br/>
- **setScope**(scope: `RequestScope`)<br/>
- _scope:_ [`RequestScope`](../../../lib/cli/node_modules/@alfresco/js-api/src/api/search-rest-api/model/requestScope.ts) -
- _scope:_ `RequestScope` -
- **update**(queryBody?: `QueryBody`)<br/>
Builds the current query and triggers the `updated` event.

View File

@ -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 `<data-column>` element example:
<data-column [customData]="MyCustomData" key="id" title="Id"></data-column>
```
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 }> = {

View File

@ -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

View File

@ -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

View File

@ -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)? |

View File

@ -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)`<any>`<br/>
Loads the config file.
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<any>` - 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)`>`<br/>
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)`<any>`<br/>
Requests notification of a property value when it is loaded.
- _property:_ `string` - The desired property value

View File

@ -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)<br/>
- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<any>` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)<br/>
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<any>` - 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`)<br/>
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>`<br/>
- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<any>` = `this.defaultValue`): `Type<any>`<br/>
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<any>` - Default type returned for field types that are not yet mapped.
- **Returns** `Type<any>` - Component type
- **setComponentTypeResolver**(type: `string`, resolver: [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts), override: `boolean` = `true`)<br/>
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

View File

@ -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)`>`<br/>
- **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)`>`<br/>
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

View File

@ -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)`>`<br/>
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)`>`<br/>
- **getEcmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<RepositoryInfo>`<br/>
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)`<RepositoryInfo>` - ProductVersionModel containing product details
## Details

View File

@ -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)<br/>
- **remapFavoritesData**(data: `FavoritePaging` = `{}`): [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)<br/>
- _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`<br/>

View File

@ -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)<br/>
- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<any>` = `this.defaultValue`): [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts)<br/>
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<any>` - 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`)<br/>
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>`<br/>
- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<any>` = `this.defaultValue`): `Type<any>`<br/>
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<any>` - Default type returned for field types that are not yet mapped.
- **Returns** `Type<any>` - Component type
- **setComponentTypeResolver**(type: `string`, resolver: [`DynamicComponentResolveFunction`](../../../lib/core/services/dynamic-component-mapper.service.ts), override: `boolean` = `true`)<br/>
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

View File

@ -13,10 +13,10 @@ Decodes a JSON Web Token (JWT) to a JavaScript object.
### Methods
- **decodeToken**(token: `any`): `Object`<br/>
- **decodeToken**(token: `any`): `any`<br/>
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`<br/>
Gets access token
- **Returns** `string` - access token

View File

@ -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)`<any>`<br/>
Gets information about the user who is currently logged in.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - User information
- **getPerson**(personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
- **getCurrentUserInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`<br/>
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)`>`<br/>
Gets information about a user identified by their username.
- _personId:_ `string` - ID of the target user
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - User information
- **isContentAdmin**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<boolean>`<br/>
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<boolean>` -
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - User information
- **getUserProfileImage**(avatarId: `string`): `string`<br/>
Returns a profile image as a URL.
- _avatarId:_ `string` - Target avatar
- **Returns** `string` - Image URL
- **isCurrentUserAdmin**(): `boolean`<br/>
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)`>`<br/>
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)`>`<br/>
- **resetLocalCurrentUser**()<br/>
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)`>`<br/>
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

View File

@ -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>`<br/>
- **createRendition**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
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)`<any>` - Null response to indicate completion
- **generateRenditionForNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Generates a rendition for a node using the first available encoding.
- _nodeId:_ `string` - ID of the target node

View File

@ -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)`>`<br/>
- **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)`>`<br/>
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)`>`<br/>
Create a site membership for group
@ -52,24 +52,24 @@ Accesses and manipulates sites from a Content Services repository.
- **getEcmCurrentLoggedUserName**(): `string`<br/>
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>`<br/>
- **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>`<br/>
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>`<br/>
- **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>`<br/>
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)`>`<br/>
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)&lt;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>`<br/>
- **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>`<br/>
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)`>`<br/>
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)`>`<br/>
- **listSiteGroups**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<SiteGroupPaging>`<br/>
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)&lt;SiteGroupPaging>
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<SiteGroupPaging>` - [`Observable`](http://reactivex.io/documentation/observable.html)&lt;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)`>`<br/>
Gets a list of all a site's members.
- _siteId:_ `string` - ID of the target site

View File

@ -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<string>`, interpolateParams?: `Object`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string|any>`<br/>
- **get**(key: `string|Array<string>`, interpolateParams?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string|any>`<br/>
Gets the translation for the supplied key.
- _key:_ `string|Array<string>` - 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)`<string|any>` - Translated text
- **instant**(key: `string|Array<string>`, interpolateParams?: `Object`): `string|any`<br/>
- **instant**(key: `string|Array<string>`, interpolateParams?: `any`): `string|any`<br/>
Directly returns the translation for the supplied key.
- _key:_ `string|Array<string>` - 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`)<br/>
Loads a translation file.

View File

@ -20,11 +20,16 @@ Provides access to various APIs related to file upload features.
- **cancelUpload**(files: [`FileModel`](../../../lib/core/models/file.model.ts)`[]`)<br/>
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**()<br/>
- **clearQueue**()<br/>
Clears the upload queue
- **getQueue**(): [`FileModel`](../../../lib/core/models/file.model.ts)`[]`<br/>
Gets the file Queue
- **Returns** [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - Array of files that form the queue
- **getThreadsCount**(): `number`<br/>
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`<br/>
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**

View File

@ -12,16 +12,18 @@ Checks the global and application access of a user
## Class members
### Methods
- **fetchUserAccess**()<br/>
Fetches the global and application access of the user
- **hasApplicationAccess**(appName: `string`, rolesToCheck: string[]): `boolean`<br/>
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`<br/>
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**() <br>
Resets the cached access of the user
- **fetchUserAccess**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<void>`<br/>
Fetches the global and application access of the user
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<void>` -
- **hasApplicationAccess**(appName: `string`, rolesToCheck: `string[]`): `boolean`<br/>
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`<br/>
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**()<br/>
Resets the cached user access

View File

@ -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<Type<__type>>`<br/>
- **getAuthGuards**(ids: `string[]`): `Array<Type<any>>`<br/>
Retrieves one or more auth guards using an array of ID values.
- _ids:_ `string[]` - Array of ID value to look for
- **Returns** `Array<Type<__type>>` - Array of auth guards or empty array if none were found
- **Returns** `Array<Type<any>>` - Array of auth guards or empty array if none were found
- **getComponentById**(id: `string`): `Type<>`<br/>
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)`>`<br/>
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`<br/>
- **runExpression**(value: `string|any`, context?: `any`): `any`<br/>
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`)<br/>
Adds one or more new auth guards to the existing set.
- _values:_ `Function` - The new auth guards to add

View File

@ -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

View File

@ -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

View File

@ -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. |

View File

@ -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

View File

@ -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

View File

@ -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. |

View File

@ -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

View File

@ -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

View File

@ -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. |

View File

@ -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)<br/>
- **readQueryParams**(obj: `any`): [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)<br/>
- _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)`[]>`<br/>
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`<br/>
- **writeQueryParams**(value: `any`, filterProperties: `string[]`, appName?: `string`, id?: `string`): `any`<br/>
- _value:_ `Object` -
- _value:_ `any` -
- _filterProperties:_ `string[]` -
- _appName:_ `string` - (Optional)
- _id:_ `string` - (Optional)
- **Returns** `Object` -
- **Returns** `any` -
## Inject Preference service

View File

@ -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)`>`<br/>
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)`<void>`<br/>
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)`<void>` -
- **getBasePath**(appName: `string`): `string`<br/>
@ -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)`[]>`<br/>
- **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)`[]>`<br/>
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)`[]>`<br/>
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)`>`<br/>
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)`>`<br/>
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)`>`<br/>
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

View File

@ -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)`<any>`<br/>
- **getTaskByRequest**(requestNode: [`TaskQueryCloudRequestModel`](../../../lib/process-services-cloud/src/lib/models/filter-cloud-model.ts), queryUrl?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
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)`<any>` - 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.

View File

@ -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 |

View File

@ -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. |

View File

@ -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. |

View File

@ -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();

View File

@ -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',

View File

@ -65,4 +65,8 @@ export class EcmUserModel {
this.properties = obj && obj.properties;
this.capabilities = obj && obj.capabilities;
}
isAdmin(): boolean {
return this.capabilities?.isAdmin;
}
}

View File

@ -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();
});
});
});

View File

@ -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<boolean> {
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<boolean> {
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<boolean> {
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);
}
}

View File

@ -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);
});
});

View File

@ -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<any> {
const promise = this.peopleApi.getPerson(personId);
getPerson(personId: string): Observable<EcmUserModel> {
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<EcmUserModel> {
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<any> {
getCurrentUserInfo(): Observable<EcmUserModel> {
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<boolean> {
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[] {

View File

@ -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';

View File

@ -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<EcmUserModel> {
constructor(private peopleContentService: PeopleContentService) {}
resolve(
_route: ActivatedRouteSnapshot,
_state: RouterStateSnapshot
): Observable<EcmUserModel> {
return this.peopleContentService.getCurrentUserInfo();
}
}

View File

@ -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 ', () => {

View File

@ -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 {