[ADF-4048] PeopleCloudComponent - improve preselect input functionality (#4286)

* fix conflicts

* [ADF-4048] - fix add same user on multiple selection

* [ADF-4048] PeopleCloudComponent change validation users functionality

* [ADF-4048] PeopleCloudComponent - focus input when preselected user exists

* [ADF-4048] PeopleCloudComponent - pull request changes

* [ADF-4048] - lint

* [ADF-4048] PeopleCloud - PR changes

* [ADF-4048] - fix conflicts

* [ADF-4048] fx lint
This commit is contained in:
Silviu Popa
2019-03-06 15:26:51 +02:00
committed by Maurizio Vitale
parent 5d3f47eacf
commit f7a399c3e8
8 changed files with 352 additions and 71 deletions

View File

@@ -5,9 +5,9 @@ Status: Active
Last reviewed: 2019-02-08
---
# [Identity user service](../../lib/core/userinfo/services/identity-user.service.ts "Defined in identity-user.service.ts")
# [Identity user service](../../lib/lib/core/userinfo/services/identity-user.service.ts "Defined in identity-user.service.ts")
Gets OAuth2 personal details and roles for users.
Gets OAuth2 personal details and roles for users.
## Class members
@@ -40,9 +40,21 @@ Gets OAuth2 personal details and roles for users.
- _userId:_ `string` - ID of the target user
- _roleNames:_ `string[]` - Array of roles to check for
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>` - True if the user has one of the roles, false otherwise
- **findUserByEmail**(email: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Find users based on email input.
- _email:_ `string` - [Search](../../lib/node_modules/@alfresco/js-api/src/api-legacy/legacy.ts) query string
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of users
- **findUserById**(id: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Find users based on id input.
- _id:_ `string` - [Search](../../lib/node_modules/@alfresco/js-api/src/api-legacy/legacy.ts) query string
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - users object
- **findUserByUsername**(username: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Find users based on username input.
- _username:_ `string` - [Search](../../lib/node_modules/@alfresco/js-api/src/api-legacy/legacy.ts) query string
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of users
- **findUsersByName**(search: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Find users based on search input.
- _search:_ `string` - Search query string
- _search:_ `string` - [Search](../../lib/node_modules/@alfresco/js-api/src/api-legacy/legacy.ts) query string
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of users
- **getClientIdByApplicationName**(applicationName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string>`<br/>
Gets the client ID for an application.
@@ -59,8 +71,8 @@ Gets OAuth2 personal details and roles for users.
- **getUserRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
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)`[]>`<br/>
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../lib/lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of role info objects
- **getUsers**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../lib/lib/core/userinfo/models/identity-user.model.ts)`[]>`<br/>
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)`[]>`<br/>

View File

@@ -26,13 +26,14 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu
| ---- | ---- | ------------- | ----------- |
| appName | `string` | | Name of the application. If specified, this shows the users who have access to the app. |
| mode | `string` | | User selection mode (single/multiple). |
| preSelectUsers | [`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. |
| preSelectUsers | [`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. Mandatory properties are: id, email, username |
| roles | `string[]` | | Role names of the users to be listed. |
| 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
| Name | Type | Description |
| ---- | ---- | ----------- |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs. |
| removeUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`>` | Emitted when a selected user is removed in multi selection mode. |
| selectUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../lib/core/userinfo/models/identity-user.model.ts)`>` | Emitted when a user is selected. |
| warning | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an warning occurs. |