Current User
A sub namespace of Document, exclusive for the current logged user operations
getClients
Description
This method can be used to get current logged user clients.
Method(s)
1 declare function getClients(
2 params: {
3 name?: string,
4 skip?: number,
5 take?: number
6 } = {
7 name: "",
8 skip: 0,
9 take: 0
10 }
11 ): Promise<CommercialClientLookupDto[]>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string | false | Name to filter the search | |
skip | number | false | 0 | Allows you skip the first results returned by the method |
take | number | false | 0 | Set a maximum number of result you want to return |
Basic Usage
SW.Document.CurrentUser.getClients({ name:"SkillsWorkflow", skip: 0, take: 20});
getCompanies
Description
This method can be used to get current logged user companies.
Method(s)
declare function getCompanies(params: { name?: string, skip?: number, take?: number } = { name: "", skip: 0, take: 0 });
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string | false | Name to filter the search | |
skip | number | false | 0 | Allows you skip the first results returned by the method |
take | number | false | 0 | Set a maximum number of result you want to return |
Basic Usage
SW.Document.CurrentUser.getCompanies({ name:"SkillsWorkflow", skip: 0, take: 20});
getDivisons
Description
This method can be used to get current logged user divisions.
Method(s)
declare function getDivisions(
params: {
name?: string,
skip?: number,
take?: number
} = {
name: "",
skip: 0,
take: 0
}
):
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string | false | Name to filter the search | |
skip | number | false | 0 | Allows you skip the first results returned by the method |
take | number | false | 0 | Set a maximum number of result you want to return |
Basic Usage
SW.Document.CurrentUser.getDivisions({ name:"SkillsWorkflow", skip: 0, take: 20});
getInfo
Description
This method can be used to get current logged user information.
Method(s)
1 declare function getInfo(): UserInfo
Basic Usage
SW.Document.CurrentUser.getInfo();
hasAllRoles
Description
This method can be used to check if the current logged user has all given roles.
Method(s)
1 declare function hasAllRoles(roles: string[]): boolean;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
roles | string[] | true | Roles to check |
Basic Usage
SW.Document.CurrentUser.hasAllRoles(["Admin", "Manager"]);
Response
false
hasAnyRoles
Description
This method can be used to check if the current logged user has any of the given roles.
Method(s)
1 declare function hasAnyRoles(roles: string[]): boolean;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
roles | string[] | true | Roles to check |
Basic Usage
SW.Document.CurrentUser.hasAnyRoles(["Admin", "Manager"]);
Response
true
hasRole
Description
This method can be used to check if the current logged user has the given role.
Method(s)
1 declare function hasRole(roleName: string): boolean;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
roleName | string | true | Role to check |
Basic Usage
SW.Document.CurrentUser.hasRole("Admin");
Response
false
hasRoles
Description
This method can be used to check if the current logged user has each of the given roles or not.
Method(s)
1 declare function hasRoles(roles: string[]): { [roleName: string]: boolean };
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
roles | string[] | true | Roles to check |
Basic Usage
SW.Document.CurrentUser.hasRoles(["Admin", "Manager"]);
Response
{ Admin: false, Manager: true }