Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TenantService

description

This service allows for managing tenants.

Hierarchy

Index

Constructors

constructor

Methods

create

  • Creates a new tenant.

    example
    
     const tenantObject = {
       id: "sample_tenant",
       company: "sample_company",
       domain: "sample_domain.com",
       contactName: "Mr. Doe",
       ...
     };
    
     (async () => {
       const {data, res} = await tenantService.create(tenantObject);
     })();
    

    Required role: ROLE_TENANT_MANAGEMENT_ADMIN or ROLE_TENANT_MANAGEMENT_CREATE

    Note that creating a tenant with adminName, adminPass and adminEmail, creates an admin user with these settings. For the tenant id SQL keywords (e.g., select, cross, where) are not allowed.

    Parameters

    Returns Promise<IResult<ITenant>>

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

current

delete

  • delete(entityOrId: string | number | ITenant): Promise<IResult<null>>
  • Delete a representation of a tenant.

    example
    
       const tenantId: string = "uniqueTenantId";
    
       (async () => {
         const {data, res} = await tenantService.delete(tenantId);
      })();
    

    Required role: ROLE_TENANT_MANAGEMENT_ADMIN

    Parameters

    • entityOrId: string | number | ITenant

      Tenant's id or tenant object.

    Returns Promise<IResult<null>>

    Returns promise object that is resolved with the IResult.

detail

  • Get a representation of a tenant.

    example
    
       const tenantId: number = 1;
    
       (async () => {
         const {data, res} = await tenantService.detail(tenantId);
      })();
    

    Required role: ROLE_TENANT_MANAGEMENT_READ

    User password is never returned in GET response. Authentication mechanism is provided by another interface.

    Parameters

    • entityOrId: string | number | ITenant

      Tenant's id or tenant object.

    Returns Promise<IResult<ITenant>>

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

list

  • Gets the list of tenants filtered by parameters.

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

    Required role: ROLE_TENANT_MANAGEMENT_READ

    Parameters

    • Default value filter: object = {}

      Object containing filters for querying tenants.

    Returns Promise<IResultList<ITenant>>

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

update

  • Updates tenant data.

    example
    
     const partialUpdateObject: IIdentified = {
        adminName : "newAdmin"
        ...
      }
    
     (async () => {
       const {data, res} = await tenantService.update(partialUpdateObject);
     })();
    

    Required role: ROLE_TENANT_MANAGEMENT_ADMIN or ROLE_TENANT_MANAGEMENT_UPDATE

    Note that updating adminPass and adminEmail updates these settings in the admin user of the tenant. Updating adminName has no effect.

    Parameters

    • entity: ITenant

      Tenant is partially updatable.

    Returns Promise<IResult<ITenant>>

    Returns promise object that is resolved with the saved tenant object.

Generated using TypeDoc