diff --git a/docs/README.md b/docs/README.md index 9e5d0f2eff..8f20b69822 100644 --- a/docs/README.md +++ b/docs/README.md @@ -161,8 +161,10 @@ for more information about installing and using the source code. | [Cookie service](core/cookie.service.md) | Stores key-value data items as browser cookies. | [Source](../lib/core/services/cookie.service.ts) | | [Deleted nodes api service](core/deleted-nodes-api.service.md) | Gets a list of Content Services nodes currently in the trash. | [Source](../lib/core/services/deleted-nodes-api.service.ts) | | [Discovery api service](core/discovery-api.service.md) | Gets version and license information for Process Services and Content Services. | [Source](../lib/core/services/discovery-api.service.ts) | +| [Download zip service](core/download-zip.service.md) | Creates and manages downloads. | [Source](../lib/core/services/download-zip.service.ts) | | [Favorites api service](core/favorites-api.service.md) | Gets a list of items a user has marked as their favorites. | [Source](../lib/core/services/favorites-api.service.ts) | | [Highlight transform service](core/highlight-transform.service.md) | Adds HTML to a string to highlight chosen sections. | [Source](../lib/core/services/highlight-transform.service.ts) | +| [Jwt helper service](core/jwt-helper.service.md) | Decodes a JSON Web Token (JWT) to a JavaScript object. | [Source](../lib/core/services/jwt-helper.service.ts) | | [Log service](core/log.service.md) | Provides log functionality. | [Source](../lib/core/services/log.service.ts) | | [Login dialog service](core/login-dialog.service.md) | Manages login dialogs. | [Source](../lib/core/services/login-dialog.service.ts) | | [Nodes api service](core/nodes-api.service.md) | Accesses and manipulates ACS document nodes using their node IDs. | [Source](../lib/core/services/nodes-api.service.ts) | @@ -182,9 +184,8 @@ for more information about installing and using the source code. | [User preferences service](core/user-preferences.service.md) | Stores preferences for the app and for individual components. | [Source](../lib/core/services/user-preferences.service.ts) | | [Bpm user service](core/bpm-user.service.md) | Gets information about the current Process Services user. | [Source](../lib/core/userinfo/services/bpm-user.service.ts) | | [Ecm user service](core/ecm-user.service.md) | Gets information about a Content Services user. | [Source](../lib/core/userinfo/services/ecm-user.service.ts) | -| _[Download zip service](../../lib/core/services/download-zip.service.ts)_ | _Not currently documented_ | [Source](../lib/core/services/download-zip.service.ts) | -| _[Jwt helper service](../../lib/core/services/jwt-helper.service.ts)_ | _Not currently documented_ | [Source](../lib/core/services/jwt-helper.service.ts) | -| _[Identity](../../e2e/actions/APS-cloud/identity.ts) user service_ | _Not currently documented_ | [Source](../lib/core/userinfo/services/identity-user.service.ts) | +| [Identity user service](core/identity-user.service.md) | Gets OAuth2 personal details and roles for users. | [Source](../lib/core/userinfo/services/identity-user.service.ts) | +actions/APS-cloud/identity.ts) user service_ | _Not currently documented_ | [Source](../lib/core/userinfo/services/identity-user.service.ts) | ## Widgets diff --git a/docs/core/README.md b/docs/core/README.md index e8a045588e..e99c5ae16d 100644 --- a/docs/core/README.md +++ b/docs/core/README.md @@ -17,7 +17,7 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | | [About component](about.component.md) ![Experimental](../docassets/images/ExperimentalIcon.png) | Shows a general version and status overview of the installed ADF library. | [Source](../../lib/core/about/about.component.ts) | -| [Buttons menu component](buttons-menu.component.md) | Displays buttons on a responsive menu. | [Source](../../lib/core/buttons-menu/buttons-menu.component.ts) | +| [Buttons menu component](buttons-menu.component.md) | Displays buttons on a responsive menu. | [Source](../../lib/core/buttons-menu/buttons-menu.component.ts) | | [Card view component](card-view.component.md) | Displays a configurable property list renderer. | [Source](../../lib/core/card-view/components/card-view/card-view.component.ts) | | [Comment list component](comment-list.component.md) | Shows a list of comments. | [Source](../../lib/core/comments/comment-list.component.ts) | | [Comments component](comments.component.md) | Displays comments from users involved in a specified task or content and allows an involved user to add a comment to a task or a content. | [Source](../../lib/core/comments/comments.component.ts) | @@ -26,9 +26,10 @@ for more information about installing and using the source code. | [Empty list component](empty-list.component.md) | Displays a message indicating that a list is empty. | [Source](../../lib/core/datatable/components/datatable/empty-list.component.ts) | | [Form field component](form-field.component.md) | Represents a UI field in a form. | [Source](../../lib/core/form/components/form-field/form-field.component.ts) | | [Form list component](form-list.component.md) | Shows forms as a list. | [Source](../../lib/core/form/components/form-list.component.ts) | -| [Form component](form.component.md) | Shows a [`Form`](../../lib/process-services/task-list/models/form.model.ts) from APS | [Source](../../lib/core/form/components/form.component.ts) | -| [Start form component](start-form.component.md) | Displays the Start [`Form`](../../lib/process-services/task-list/models/form.model.ts) for a process. | [Source](../../lib/core/form/components/start-form.component.ts) | +| [Form component](form.component.md) | Shows a Form from APS | [Source](../../lib/core/form/components/form.component.ts) | +| [Start form component](start-form.component.md) | Displays the Start Form for a process. | [Source](../../lib/core/form/components/start-form.component.ts) | | [Text mask component](text-mask.component.md) | Implements text field input masks. | [Source](../../lib/core/form/components/widgets/text/text-mask.component.ts) | +| [Icon component](icon.component.md) | Provides universal way of rendering registered and named icons. | [Source](../../lib/core/icon/icon.component.ts) | | [Info drawer layout component](info-drawer-layout.component.md) | Displays a sidebar-style information panel. | [Source](../../lib/core/info-drawer/info-drawer-layout.component.ts) | | [Info drawer component](info-drawer.component.md) | Displays a sidebar-style information panel with tabs. | [Source](../../lib/core/info-drawer/info-drawer.component.ts) | | [Language menu component](language-menu.component.md) | Displays all the languages that are present in "app.config.json" and the default (EN). | [Source](../../lib/core/language-menu/language-menu.component.ts) | @@ -45,7 +46,7 @@ for more information about installing and using the source code. | [Empty content component](empty-content.component.md) | Provides a generic "Empty Content" placeholder for components. | [Source](../../lib/core/templates/empty-content/empty-content.component.ts) | | [Error content component](error-content.component.md) | Displays info about a specific error. | [Source](../../lib/core/templates/error-content/error-content.component.ts) | | [Toolbar divider component](toolbar-divider.component.md) | Divides groups of elements in a Toolbar with a visual separator. | [Source](../../lib/core/toolbar/toolbar-divider.component.ts) | -| [Toolbar title component](toolbar-title.component.md) | Supplies custom HTML to be included in a [Toolbar component](../core/toolbar.component.md) title. | [Source](../../lib/core/toolbar/toolbar-title.component.ts) | +| [Toolbar title component](toolbar-title.component.md) | Supplies custom HTML to be included in a Toolbar component title. | [Source](../../lib/core/toolbar/toolbar-title.component.ts) | | [Toolbar component](toolbar.component.md) | Simple container for headers, titles, actions and breadcrumbs. | [Source](../../lib/core/toolbar/toolbar.component.ts) | | [User info component](user-info.component.md) | Shows user information. | [Source](../../lib/core/userinfo/components/user-info.component.ts) | | [Viewer component](viewer.component.md) | Displays content from an ACS repository. | [Source](../../lib/core/viewer/components/viewer.component.ts) | @@ -58,6 +59,7 @@ for more information about installing and using the source code. | [Highlight directive](highlight.directive.md) | Adds highlighting to selected sections of an HTML element's content. | [Source](../../lib/core/directives/highlight.directive.ts) | | [Logout directive](logout.directive.md) | Logs the user out when the decorated element is clicked. | [Source](../../lib/core/directives/logout.directive.ts) | | [Node delete directive](node-delete.directive.md) | Deletes multiple files and folders. | [Source](../../lib/core/directives/node-delete.directive.ts) | +| [Node download directive](node-download.directive.md) | Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive. | [Source](../../lib/core/directives/node-download.directive.ts) | | [Node favorite directive](node-favorite.directive.md) | Selectively toggles nodes as favorites. | [Source](../../lib/core/directives/node-favorite.directive.ts) | | [Node permission directive](node-permission.directive.md) | Selectively disables an HTML element or Angular component. | [Source](../../lib/core/directives/node-permission.directive.ts) | | [Node restore directive](node-restore.directive.md) | Restores deleted nodes to their original location. | [Source](../../lib/core/directives/node-restore.directive.ts) | @@ -67,7 +69,7 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | -| [Form field model](form-field.model.md) | Contains the value and metadata for a field of a [`Form`](../../lib/process-services/task-list/models/form.model.ts) component. | [Source](../../lib/core/form/components/widgets/core/form-field.model.ts) | +| [Form field model](form-field.model.md) | Contains the value and metadata for a field of a Form component. | [Source](../../lib/core/form/components/widgets/core/form-field.model.ts) | | [Product version model](product-version.model.md) | Contains version and license information classes for Alfresco products. | [Source](../../lib/core/models/product-version.model.ts) | | [User process model](user-process.model.md) | Represents a Process Services user. | [Source](../../lib/core/models/user-process.model.ts) | | [Bpm user model](bpm-user.model.md) | Contains information about a Process Services user. | [Source](../../lib/core/userinfo/models/bpm-user.model.ts) | @@ -79,23 +81,23 @@ for more information about installing and using the source code. | ---- | ----------- | ----------- | | [File size pipe](file-size.pipe.md) | Converts a number of bytes to the equivalent in KB, MB, etc. | [Source](../../lib/core/pipes/file-size.pipe.ts) | | [Format space pipe](format-space.pipe.md) | Replaces all the white space in a string with a supplied character. | [Source](../../lib/core/pipes/format-space.pipe.ts) | -| [Full name pipe](full-name.pipe.md) | Joins the first and last name properties from a [`UserProcessModel`](../core/user-process.model.md) object into a single string. | [Source](../../lib/core/pipes/full-name.pipe.ts) | +| [Full name pipe](full-name.pipe.md) | Joins the first and last name properties from a UserProcessModel object into a single string. | [Source](../../lib/core/pipes/full-name.pipe.ts) | | [Mime type icon pipe](mime-type-icon.pipe.md) | Retrieves an icon to represent a MIME type. | [Source](../../lib/core/pipes/mime-type-icon.pipe.ts) | | [Node name tooltip pipe](node-name-tooltip.pipe.md) | Formats the tooltip for a Node. | [Source](../../lib/core/pipes/node-name-tooltip.pipe.ts) | | [Text highlight pipe](text-highlight.pipe.md) | Adds highlighting to words or sections of text that match a search string. | [Source](../../lib/core/pipes/text-highlight.pipe.ts) | | [Time ago pipe](time-ago.pipe.md) | Converts a recent past date into a number of days ago. | [Source](../../lib/core/pipes/time-ago.pipe.ts) | -| [User initial pipe](user-initial.pipe.md) | Takes the name fields of a [`UserProcessModel`](../core/user-process.model.md) object and extracts and formats the initials. | [Source](../../lib/core/pipes/user-initial.pipe.ts) | +| [User initial pipe](user-initial.pipe.md) | Takes the name fields of a UserProcessModel object and extracts and formats the initials. | [Source](../../lib/core/pipes/user-initial.pipe.ts) | ## Services | Name | Description | Source link | | ---- | ----------- | ----------- | -| [Card item types service](card-item-types.service.md) | Maps type names to field component types for the [Card View component](../core/card-view.component.md). | [Source](../../lib/core/card-view/services/card-item-types.service.ts) | -| [Card view update service](card-view-update.service.md) | Reports edits and clicks within fields of a [Card View component](../core/card-view.component.md). | [Source](../../lib/core/card-view/services/card-view-update.service.ts) | +| [Card item types service](card-item-types.service.md) | Maps type names to field component types for the Card View component. | [Source](../../lib/core/card-view/services/card-item-types.service.ts) | +| [Card view update service](card-view-update.service.md) | Reports edits and clicks within fields of a Card View component. | [Source](../../lib/core/card-view/services/card-view-update.service.ts) | | [Activiti alfresco service](activiti-alfresco.service.md) | Gets Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS). | [Source](../../lib/core/form/services/activiti-alfresco.service.ts) | -| [Form rendering service](form-rendering.service.md) | Maps a form field type string onto the corresponding form [widget](../../e2e/pages/adf/process_services/widgets/widget.ts) component type. | [Source](../../lib/core/form/services/form-rendering.service.ts) | +| [Form rendering service](form-rendering.service.md) | Maps a form field type string onto the corresponding form widget component type. | [Source](../../lib/core/form/services/form-rendering.service.ts) | | [Form service](form.service.md) | Implements Process Services form methods | [Source](../../lib/core/form/services/form.service.ts) | -| [Node service](node.service.md) | Gets Alfresco Repository node metadata and creates nodes with metadata. | [Source](../../lib/core/form/services/node.service.ts) | +| [Node service](node.service.md) | Gets Alfresco Repository node metadata and creates nodes with metadata. | [Source](../../lib/core/form/services/node.service.ts) | | [Process content service](process-content.service.md) | Manipulates content related to a Process Instance or Task Instance in APS. | [Source](../../lib/core/form/services/process-content.service.ts) | | [Alfresco api service](alfresco-api.service.md) | Provides access to an initialized **AlfrescoJSApi** instance. | [Source](../../lib/core/services/alfresco-api.service.ts) | | [Apps process service](apps-process.service.md) | Gets details of the Process Services apps that are deployed for the user. | [Source](../../lib/core/services/apps-process.service.ts) | @@ -109,17 +111,20 @@ for more information about installing and using the source code. | [Cookie service](cookie.service.md) | Stores key-value data items as browser cookies. | [Source](../../lib/core/services/cookie.service.ts) | | [Deleted nodes api service](deleted-nodes-api.service.md) | Gets a list of Content Services nodes currently in the trash. | [Source](../../lib/core/services/deleted-nodes-api.service.ts) | | [Discovery api service](discovery-api.service.md) | Gets version and license information for Process Services and Content Services. | [Source](../../lib/core/services/discovery-api.service.ts) | +| [Download zip service](download-zip.service.md) | Creates and manages downloads. | [Source](../../lib/core/services/download-zip.service.ts) | | [Favorites api service](favorites-api.service.md) | Gets a list of items a user has marked as their favorites. | [Source](../../lib/core/services/favorites-api.service.ts) | | [Highlight transform service](highlight-transform.service.md) | Adds HTML to a string to highlight chosen sections. | [Source](../../lib/core/services/highlight-transform.service.ts) | +| [Jwt helper service](jwt-helper.service.md) | Decodes a JSON Web Token (JWT) to a JavaScript object. | [Source](../../lib/core/services/jwt-helper.service.ts) | | [Log service](log.service.md) | Provides log functionality. | [Source](../../lib/core/services/log.service.ts) | | [Login dialog service](login-dialog.service.md) | Manages login dialogs. | [Source](../../lib/core/services/login-dialog.service.ts) | | [Nodes api service](nodes-api.service.md) | Accesses and manipulates ACS document nodes using their node IDs. | [Source](../../lib/core/services/nodes-api.service.ts) | | [Notification service](notification.service.md) | Shows a notification message with optional feedback. | [Source](../../lib/core/services/notification.service.ts) | | [Page title service](page-title.service.md) | Sets the page title. | [Source](../../lib/core/services/page-title.service.ts) | -| [People content service](people-content.service.md) | Gets information about a Content Services user. | [Source](../../lib/core/services/people-content.service.ts) | +| [People content service](people-content.service.md) | Gets information about a Content Services user. | [Source](../../lib/core/services/people-content.service.ts) | | [People process service](people-process.service.md) | Gets information about Process Services users. | [Source](../../lib/core/services/people-process.service.ts) | | [Renditions service](renditions.service.md) ![Deprecated](../docassets/images/DeprecatedIcon.png) | Manages prearranged conversions of content to different formats. | [Source](../../lib/core/services/renditions.service.ts) | | [Search configuration service](search-configuration.service.md) | Provides fine control of parameters to a search. | [Source](../../lib/core/services/search-configuration.service.ts) | +| [Search service](search.service.md) | Accesses the Content Services Search API. | [Source](../../lib/core/services/search.service.ts) | | [Shared links api service](shared-links-api.service.md) | Finds shared links to Content Services items. | [Source](../../lib/core/services/shared-links-api.service.ts) | | [Sites service](sites.service.md) | Accesses and manipulates sites from a Content Services repository. | [Source](../../lib/core/services/sites.service.ts) | | [Storage service](storage.service.md) | Stores items in the form of key-value pairs. | [Source](../../lib/core/services/storage.service.ts) | @@ -129,8 +134,7 @@ for more information about installing and using the source code. | [User preferences service](user-preferences.service.md) | Stores preferences for the app and for individual components. | [Source](../../lib/core/services/user-preferences.service.ts) | | [Bpm user service](bpm-user.service.md) | Gets information about the current Process Services user. | [Source](../../lib/core/userinfo/services/bpm-user.service.ts) | | [Ecm user service](ecm-user.service.md) | Gets information about a Content Services user. | [Source](../../lib/core/userinfo/services/ecm-user.service.ts) | -| _[Jwt helper service](../../lib/core/services/jwt-helper.service.ts)_ | _Not currently documented_ | [Source](../../lib/core/services/jwt-helper.service.ts) | -| _[Identity user service](../../lib/core/userinfo/services/identity-user.service.ts)_ | _Not currently documented_ | [Source](../../lib/core/userinfo/services/identity-user.service.ts) | +| [Identity user service](identity-user.service.md) | Gets OAuth2 personal details and roles for users. | [Source](../../lib/core/userinfo/services/identity-user.service.ts) | ## Widgets diff --git a/docs/core/download-zip.service.md b/docs/core/download-zip.service.md new file mode 100644 index 0000000000..7f9046ac83 --- /dev/null +++ b/docs/core/download-zip.service.md @@ -0,0 +1,46 @@ +--- +Title: Download zip service +Added: v2.0.0 +Status: Active +Last reviewed: 2019-01-08 +--- + +# [Download zip service](../../lib/core/services/download-zip.service.ts "Defined in download-zip.service.ts") + +Creates and manages downloads. + +## Class members + +### Methods + +- **cancelDownload**(downloadId: `string`)
+ Cancels a download. + - _downloadId:_ `string` - ID of the target download node +- **createDownload**(payload: [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadBodyCreate.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md)`>`
+ Creates a new download. + - _payload:_ [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadBodyCreate.md) - Object containing the node IDs of the items to add to the ZIP file + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md)`>` - Status object for the download +- **getContentUrl**(nodeId: `string`, attachment?: `boolean`): `string`
+ Gets a content URL for the given node. + - _nodeId:_ `string` - Node to get URL for. + - _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download + - **Returns** `string` - URL string +- **getDownload**(downloadId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md)`>`
+ Gets status information for a download node. + - _downloadId:_ `string` - ID of the download node + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md)`>` - Status object for the download +- **getNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`
+ Gets a Node via its node ID. + - _nodeId:_ `string` - ID of the target node + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the node + +## Details + +Use `createDownload` to create a node that will represent the downloadable +ZIP data. The ZIP archive includes the content of all node IDs passed in via +the [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadBodyCreate.md) parameter. + +The [`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md) object returned by `createDownload` has an +`id` field that you can use to identify the download node (eg, +to cancel it later or get the node URL when the download is complete) and +other information about the progress of the download. diff --git a/docs/core/identity-user.service.md b/docs/core/identity-user.service.md new file mode 100644 index 0000000000..3af046711b --- /dev/null +++ b/docs/core/identity-user.service.md @@ -0,0 +1,49 @@ +--- +Title: Identity user service +Added: v3.0.0 +Status: Active +Last reviewed: 2019-01-09 +--- + +# [Identity user service](../../lib/core/userinfo/services/identity-user.service.ts "Defined in identity-user.service.ts") + +Gets OAuth2 personal details and roles for users. + +## Class members + +### Methods + +- **getCurrentUserInfo**(): [`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)
+ Gets the name and other basic details of the current user. + - **Returns** [`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts) - The user's details +- **getUserRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../lib/core/userinfo/models/identity-role.model.ts)`[]>`
+ Gets a list of roles for a user. + - _userId:_ `string` - ID of the user + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of role info objects +- **getUsers**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>`
+ Gets details for all users. + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects +- **getUsersByRolesWithCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>`
+ Gets an array of users (including the current user) who have any of the roles in the supplied list. + - _roleNames:_ `string[]` - List of role names to look for + - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects +- **getUsersByRolesWithoutCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>`
+ Gets an array of users (not including the current user) who have any of the roles in the supplied list. + - _roleNames:_ `string[]` - List of role names to look for + - **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects +- **getValueFromToken**(key: `string`)
+ Gets a named value from the user access token. + - _key:_ `string` - Key name of the field to retrieve + +## Details + +[OAuth2](https://oauth.net/2/) defines an _access token_ (used when +authenticating a user) and a number of _authentication roles_ that the user +can participate in (see +[this page](https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2) +for an introduction to OAuth2 and a description of the roles). You can use the +[Identity user service](identity-user.service.md) to access this information for users, including the current user. + +## See also + +- [JWT helper service](../core/jwt-helper.service.md) diff --git a/docs/core/jwt-helper.service.md b/docs/core/jwt-helper.service.md new file mode 100644 index 0000000000..54a7296e03 --- /dev/null +++ b/docs/core/jwt-helper.service.md @@ -0,0 +1,29 @@ +--- +Title: JWT helper service +Added: v3.0.0 +Status: Active +Last reviewed: 2019-01-09 +--- + +# [JWT helper service](../../lib/core/services/jwt-helper.service.ts "Defined in jwt-helper.service.ts") + +Decodes a JSON Web Token (JWT) to a JavaScript object. + +## Class members + +### Methods + +- **decodeToken**(token: `any`): `Object`
+ Decodes a JSON web token into a JS object. + - _token:_ `any` - Token in encoded form + - **Returns** `Object` - Decoded token data object + +## Details + +JWT is a standard for sending data securely that ADF uses during the +OAuth2 authentication procedure. See the [JWT website](https://jwt.io/) +for full details of the standard and its uses. + +## See also + +- [Identity user service](identity-user.service.md) diff --git a/lib/core/services/download-zip.service.ts b/lib/core/services/download-zip.service.ts index a1841449fe..12af8eed08 100755 --- a/lib/core/services/download-zip.service.ts +++ b/lib/core/services/download-zip.service.ts @@ -31,24 +31,49 @@ export class DownloadZipService { private logService: LogService) { } + /** + * Creates a new download. + * @param payload Object containing the node IDs of the items to add to the ZIP file + * @returns Status object for the download + */ createDownload(payload: DownloadBodyCreate): Observable { return from(this.apiService.getInstance().core.downloadsApi.createDownload(payload)).pipe( catchError((err) => this.handleError(err)) ); } + /** + * Gets a content URL for the given node. + * @param nodeId Node to get URL for. + * @param attachment Toggles whether to retrieve content as an attachment for download + * @returns URL string + */ getContentUrl(nodeId: string, attachment?: boolean): string { return this.apiService.getInstance().content.getContentUrl(nodeId, attachment); } + /** + * Gets a Node via its node ID. + * @param nodeId ID of the target node + * @returns Details of the node + */ getNode(nodeId: string): Observable { return from(this.apiService.getInstance().core.nodesApi.getNode(nodeId)); } + /** + * Gets status information for a download node. + * @param downloadId ID of the download node + * @returns Status object for the download + */ getDownload(downloadId: string): Observable { return from(this.apiService.getInstance().core.downloadsApi.getDownload(downloadId)); } + /** + * Cancels a download. + * @param downloadId ID of the target download node + */ cancelDownload(downloadId: string) { this.apiService.getInstance().core.downloadsApi.cancelDownload(downloadId); } diff --git a/lib/core/services/jwt-helper.service.ts b/lib/core/services/jwt-helper.service.ts index 192299b935..b66860d342 100644 --- a/lib/core/services/jwt-helper.service.ts +++ b/lib/core/services/jwt-helper.service.ts @@ -24,6 +24,11 @@ export class JwtHelperService { constructor() {} + /** + * Decodes a JSON web token into a JS object. + * @param token Token in encoded form + * @returns Decoded token data object + */ decodeToken(token): Object { let parts = token.split('.'); diff --git a/lib/core/userinfo/services/identity-user.service.ts b/lib/core/userinfo/services/identity-user.service.ts index 28ed775bbc..cbd277c678 100644 --- a/lib/core/userinfo/services/identity-user.service.ts +++ b/lib/core/userinfo/services/identity-user.service.ts @@ -42,6 +42,10 @@ export class IdentityUserService { private apiService: AlfrescoApiService, private appConfigService: AppConfigService) {} + /** + * Gets the name and other basic details of the current user. + * @returns User details + */ getCurrentUserInfo(): IdentityUserModel { const familyName = this.getValueFromToken(IdentityUserService.FAMILY_NAME); const givenName = this.getValueFromToken(IdentityUserService.GIVEN_NAME); @@ -51,6 +55,11 @@ export class IdentityUserService { return new IdentityUserModel(user); } + /** + * Gets a named value from the user access token. + * @param key Key name of the field to retrieve + * @returns Value associated with the key + */ getValueFromToken(key: string): T { let value; const token = localStorage.getItem(IdentityUserService.USER_ACCESS_TOKEN); @@ -61,6 +70,10 @@ export class IdentityUserService { return value; } + /** + * Gets details for all users. + * @returns Array of user info objects + */ getUsers(): Observable { const url = this.buildUserUrl(); const httpMethod = 'GET', pathParams = {}, queryParams = {}, bodyParam = {}, headerParams = {}, @@ -77,6 +90,11 @@ export class IdentityUserService { ); } + /** + * Gets a list of roles for a user. + * @param userId ID of the user + * @returns Array of role info objects + */ getUserRoles(userId: string): Observable { const url = this.buildRolesUrl(userId); const httpMethod = 'GET', pathParams = {}, queryParams = {}, bodyParam = {}, headerParams = {}, @@ -93,6 +111,11 @@ export class IdentityUserService { ); } + /** + * Gets an array of users (including the current user) who have any of the roles in the supplied list. + * @param roleNames List of role names to look for + * @returns Array of user info objects + */ async getUsersByRolesWithCurrentUser(roleNames: string[]): Promise { const filteredUsers: IdentityUserModel[] = []; if (roleNames && roleNames.length > 0) { @@ -109,6 +132,11 @@ export class IdentityUserService { return filteredUsers; } + /** + * Gets an array of users (not including the current user) who have any of the roles in the supplied list. + * @param roleNames List of role names to look for + * @returns Array of user info objects + */ async getUsersByRolesWithoutCurrentUser(roleNames: string[]): Promise { const filteredUsers: IdentityUserModel[] = []; if (roleNames && roleNames.length > 0) { diff --git a/tools/doc/doctool.config.json b/tools/doc/doctool.config.json index 93c684b8be..ba56aeb807 100644 --- a/tools/doc/doctool.config.json +++ b/tools/doc/doctool.config.json @@ -40,6 +40,8 @@ "Subject": "http://reactivex.io/documentation/subject.html", "AppDefinitionRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md", "DeletedNodesPaging": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/DeletedNodesPaging.md", + "DownloadBodyCreate": "https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadBodyCreate.md", + "DownloadEntry": "https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-core-rest-api/docs/DownloadEntry.md", "MinimalNodeEntity": "../content-services/document-library.model.md", "MinimalNodeEntryEntity": "../content-services/document-library.model.md", "NodeEntry": "https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md",