Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UserGroupService

Hierarchy

Index

Constructors

constructor

Methods

addRoleToGroup

  • Parameters

    • entityOrId: string | number | Partial<IUserGroup>
    • childEntityOrSelf: string | Partial<ISource>

    Returns Promise<IResult<IRoleReference>>

    Returns promise object that is resolved with the IRoleReference wrapped by IResult.

    Example

    
       const userGroupId: number = 1;
       const roleResource: string = "[URL to the Role resource]";
    
       (async () => {
         const {data, res} = await userGroupService.addRoleToGroup(userGroupId, roleResource);
      })();
    

    When role is assigned to user, suitable audit record is created with type 'User' and activity 'User updated'.

addUserToGroup

  • Parameters

    • entityOrId: string | number | Partial<IUserGroup>
    • childEntityOrSelf: string | Partial<ISource>

    Returns Promise<IResult<IUserReference>>

    Returns promise object that is resolved with the IUserReference wrapped by IResult.

    Example

    
       const userGroupId: number = 1;
       const userResource: string = "[URL to the User resource]";
    
       (async () => {
         const {data, res} = await userGroupService.addUserToGroup(userGroupId, userResource);
      })();
    

    When user is added to group, suitable audit record is created with type 'User' and activity 'User updated'.

create

  • Parameters

    Returns Promise<IResult<IUserGroup>>

    Returns promise object that is resolved with the details of newly created user group.

    Example

    
     const userGroupObject: IUserGroup = {
       name: "new user group"
     };
    
     (async () => {
       const {data, res} = await userGroupService.create(userGroupObject);
     })();
    

delete

  • Parameters

    Returns Promise<IResult<null>>

    Returns promise object that is resolved with the IResult of null.

    Example

    
       const userGroupId: number = 1;
    
       (async () => {
         const {data, res} = await userGroupService.delete(userGroupId);
      })();
    

    When group is removed, suitable audit records are created with type 'User' and activity 'User updated' with information that user has been removed from group.

    Please, note that the ADMINS and DEVICES groups can not be deleted.

detail

  • Parameters

    Returns Promise<IResult<IUserGroup>>

    Returns promise object that is resolved with the IUserGroup wrapped by IResult.

    Example

    
       const groupId: number = 1;
    
       (async () => {
         const {data, res} = await userGroupService.detail(roleId);
      })();
    

list

  • Parameters

    • Default value filter: object = {}

    Returns Promise<IResultList<IUserGroup>>

    Returns promise object that is resolved with the IUserGroup wrapped by IResultList.

    Example

    
     const filter: object = {
        severity: Severity.MAJOR,
        pageSize: 100,
        withTotalPages: true
      };
    
      (async () => {
        const {data, res, paging} = await userGroupService.list(filter);
      })();
    

removeRoleFromGroup

  • removeRoleFromGroup(entityOrId: string | number | Partial<IUserGroup>, childEntityOrSelf: string | Partial<ISource>): Promise<IResult<null>>
  • Parameters

    • entityOrId: string | number | Partial<IUserGroup>
    • childEntityOrSelf: string | Partial<ISource>

    Returns Promise<IResult<null>>

    Returns promise object that is resolved with the IResult of null.

    Example

    
       const userGroupId: number = 1;
       const userResource: string = "[URL to the Role resource]";
    
       (async () => {
         const {data, res} = await userGroupService.removeRoleFromGroup(userGroupId, userResource);
      })();
    

removeUserFromGroup

  • removeUserFromGroup(entityOrId: string | number | Partial<IUserGroup>, childEntityOrSelf: string | Partial<ISource>): Promise<IResult<null>>
  • Parameters

    • entityOrId: string | number | Partial<IUserGroup>
    • childEntityOrSelf: string | Partial<ISource>

    Returns Promise<IResult<null>>

    Returns promise object that is resolved with the IResult of null.

    Example

    
       const userGroupId: number = 1;
       const userResource: string = "[URL to the User resource]";
    
       (async () => {
         const {data, res} = await userGroupService.removeUserFromGroup(userGroupId, userResource);
      })();
    

    When user is removed from group, suitable audit record is created with type 'User' and activity 'User updated'.

update

  • Parameters

    Returns Promise<IResult<IUserGroup>>

    Returns promise object that is resolved with the saved user group object.

    Example

    
     const partialUpdateObject: Partial<IUserGroup> = {
        "id" : 1,
        "self" : "[URL to this resource]",
        "name" : "PlatformAdministrators",
        ...
      }
    
     (async () => {
       const {data, res} = await userGroupService.update(partialUpdateObject);
     })();
    

Generated using TypeDoc