informat.user User Operations
Overview
Use the informat.user object to perform user information operations.
getUser
getUser
informat.user.getUser(id);| Parameter | Type | Description |
|---|---|---|
| id | String | User ID |
Return Value Type: User Returns user information, or null if the user does not exist.
Example:
informat.user.getUser('zhangsan');{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"tester",
"admin"
],
"userInfo": {
"age": 20
}
}getUserInfo
Query detailed user information
informat.user.getUserInfo(id);| Parameter | Type | Description |
|---|---|---|
| id | String | User ID |
Return Value Type: UserInfo Returns user information, or null if the user does not exist.
Example:
informat.user.getUserInfo('zhangsan');{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"email": "zhangsan@informat.cn",
"id": "zhangsan",
"leaderList": [
"lisi"
],
"mobileNo": "19900000000",
"name": "zhangsan",
"roleList": [
"tester",
"admin"
],
"userInfo": {
"age": 20
},
"userName": "zhangsan"
}getUserList
Query user list by user ID list
TIP
List query does not return user extended information
informat.user.getUserList(idList);| Parameter | Type | Description |
|---|---|---|
| idList | Array<String> | User ID list |
Return Value Type: Array<User> Returns the user list.
Example:
informat.user.getUserList(['zhangsan','lisi']);[
{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"tester",
"admin"
]
}
]getAppUserList
Query application member list
TIP
Note that user extended information is not returned here.
informat.user.getAppUserList();Return Value Type: Array<User> Returns the application member list.
Example:
informat.user.getAppUserList();[
{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"admin"
]
}
]getUserByRoleList
Query user list by application role list
TIP
Note that user extended information is not returned here.
informat.user.getUserByRoleList(["admin"]);| Parameter | Type | Description |
|---|---|---|
| roleList | Array<String> | Application role identifier list |
Return Value Type: Array<User> Returns the user list.
Example:
informat.user.getUserByRoleList('admin');[
{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"admin"
]
},
{
"avatar": "pic22.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "lisi",
"leaderList": [],
"name": "lisi",
"roleList": [
"admin"
]
}
]getUserByDeptList
Query user list by department list
TIP
Note that user extended information is not returned here.
informat.user.getUserByDeptList(deptList);| Parameter | Type | Description |
|---|---|---|
| deptList | Array<String> | Department identifier list |
Return Value Type: Array<User> Returns the user list.
Example:
informat.user.getUserByDeptList(["yanfabu", "yunyingbu"]);[
{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"admin"
]
}
]getSuperiorUsers
Query user direct superior list
TIP
Note that user extended information is not returned here.
informat.user.getSuperiorUsers(userId);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
Return Value Type: Array<User> Returns the user superior list.
Example:
informat.user.getSuperiorUsers('zhangsan');[
{
"avatar": "pic22.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "lisi",
"leaderList": [],
"name": "lisi",
"roleList": [
"admin"
]
}
]getSubordinateUsers
Query user direct subordinate list
TIP
Note that user extended information is not returned here.
informat.user.getSubordinateUsers(userId);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
Return Value Type: Array<User> Returns the user subordinate list.
Example:
informat.user.getSubordinateUsers('lisi');[
{
"avatar": "pic10.png",
"companyRoleList": [
"admin",
"tester"
],
"departmentList": [
"yanfabu",
"yunyingbu"
],
"id": "zhangsan",
"leaderList": [
"lisi"
],
"name": "zhangsan",
"roleList": [
"tester",
"admin"
]
}
]getLeaderOfDeptList
Query department leader list
informat.user.getLeaderOfDeptList(deptList);| Parameter | Type | Description |
|---|---|---|
| deptList | Array<String> | Department identifier list |
Return Value Type: Array<User> Returns the department leader list.
Example:
informat.user.getLeaderOfDeptList(['yunyingbu']);[
{
"avatar": "pic14.png",
"companyRoleList": [
"admin"
],
"departmentList": [
"yunyingbu"
],
"id": "l4cntsd6j16qv",
"leaderList": [],
"name": "Mr. Xiong",
"roleList": []
}
]getUserRoleList
Query application role list
informat.user.getUserRoleList();Return Value Type: Array<UserRole> Returns all application role lists.
Example:
informat.user.getUserRoleList();[
{
"admin": true,
"id": "admin",
"isAdmin": true,
"name": "admin",
"permissionList": []
},
{
"admin": false,
"id": "hrManager",
"isAdmin": false,
"name": "HR",
"permissionList": [
"AppAccess",
"AppMember",
"gkxv4nq60zdwm",
"task_taskCustomPermission"
]
}
]addUser
Add user to application
informat.user.addUser(userId, roleList);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
| roleList | Array<String> | Application role list |
Example: Add user zhangsan to the application and assign admin and tester roles
informat.user.addUser("zhangsan", ["admin", "tester"]);updateUserRole
Update application member roles
informat.user.updateUserRole(userId, roleList);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
| roleList | Array<String> | Application role list |
Example: Update user zhangsan's application role to tester
informat.user.updateUserRole("zhangsan", ["tester"]);deleteUser
Remove user from application
informat.user.deleteUser(userId);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
Example: Remove user zhangsan from the application
informat.user.deleteUser("zhangsan");getUserPermissions
Query user all application permissions
informat.user.getUserPermissions(userId);| Parameter | Type | Description |
|---|---|---|
| userId | String | User ID |
Return Value Type: Array<String> Returns the user's all application permission list.
Example: Query user zhangsan's all application permissions
informat.user.getUserPermissions("zhangsan");getAllPermissions
Query all application permission definitions
informat.user.getAllPermissions();Return Value Type: Array<String> Returns all application permission definitions.
Example: Query all application permission definitions
informat.user.getAllPermissions();
