File

core/common/tenant-ui.service.ts

Description

The helper UI service for tenant related methods built upon client services.

Index

Properties
Methods
Accessors

Constructor

constructor(userService: UserService, appStateService: AppStateService, applicationService: ApplicationService)
Parameters :
Name Type Optional
userService UserService No
appStateService AppStateService No
applicationService ApplicationService No

Methods

canReadTenants
canReadTenants()

Checks whether the current user has read access to tenants, i.e.:

  • the current tenant can create subtenants or it's the management tenant,
  • the current user has ROLE_TENANT_MANAGEMENT_READ role.
Returns : boolean

True, if the current user has read access to tenants.

getOauth2Option
getOauth2Option(loginOptions: ITenantLoginOption[])

Returns Oauth2 login option if it can be used by UI.

Example


   (() => {
     const oauth2 = tenantLoginOptionsService.getOauth2Option(loginOptions);
  })();
Parameters :
Name Type Optional
loginOptions ITenantLoginOption[] No
Returns : ITenantLoginOption

Returns ITenantLoginOption.

Example


(() => {
const oauth2 = tenantLoginOptionsService.getOauth2Option(loginOptions);
})();
getPreferredLoginOption
getPreferredLoginOption(loginOptions: ITenantLoginOption[])

Returns tenant login option which is preferred.

Example


   (() => {
     const preferredLoginOption = tenantLoginOptionsService.getPreferredLoginOption(loginOptions);
  })();
Parameters :
Name Type Optional
loginOptions ITenantLoginOption[] No
Returns : ITenantLoginOption

Returns ITenantLoginOption.

Example


(() => {
const preferredLoginOption = tenantLoginOptionsService.getPreferredLoginOption(loginOptions);
})();
getSubscribedMicroservicesInCurrentTenant
getSubscribedMicroservicesInCurrentTenant()

Gets all application of type MICROSERVICE subscribed to the current tenant. It checks the application references of the currentTenant from the application state. No additional request.

Returns : IApplication[]
isBasic
isBasic(loginOption: ITenantLoginOption)

Callback which checks if login option type is 'BASIC'.

Example


   (() => {
     const basicLoginOptions = loginOptions.filter(tenantLoginOptionsService.isBasic);
  })();
Parameters :
Name Type Optional
loginOption ITenantLoginOption No
Returns : boolean
Async isEnterpriseTenant
isEnterpriseTenant()

Checks whether current tenant is an enterprise tenant. An enterprise tenant is a tenant which has subscribed:

  • branding microservice or feature-branding feature app,
  • sslmanagement microservice,
  • feature-user-hierarchy feature app,
  • feature-broker feature app.

See https://cumulocity.com/guides/users-guide/enterprise-edition/ for details about such tenants.

Returns : Promise<boolean>

True, if current tenant is an enterprise tenant.

Async isManagementTenant
isManagementTenant()

Checks whether current tenant is the management tenant.

Returns : Promise<boolean>

True if current tenant is the management tenant.

isMicroserviceSubscribedInCurrentTenant
isMicroserviceSubscribedInCurrentTenant(identifier: string)

Checks if application of type MICROSERVICE is subscribed to the current tenant. It checks the application references of the currentTenant from the application state. No additional request.

Parameters :
Name Type Optional Description
identifier string No

application name or contextPath

Returns : boolean
isOauth2
isOauth2(loginOption: ITenantLoginOption)

Callback which checks if login option type is 'OAUTH2' and grantType is 'AUTHORIZATION_CODE'.

Example


   (() => {
     const oauth2LoginOptions = loginOptions.filter(tenantLoginOptionsService.OAUTH2);
  })();
Parameters :
Name Type Optional
loginOption ITenantLoginOption No
Returns : boolean
isOauthInternal
isOauthInternal(loginOption: ITenantLoginOption)

Callback which checks if login option type is 'OAUTH2_INTERNAL'.

Example


   (() => {
     const oauth2InternalLoginOptions = loginOptions.filter(tenantLoginOptionsService.isOauthInternal);
  })();
Parameters :
Name Type Optional
loginOption ITenantLoginOption No
Returns : boolean
isVisibleOnLoginPage
isVisibleOnLoginPage(loginOption: ITenantLoginOption)

Callback which checks if login option is visible on login page.

Example


   (() => {
     const loginOptionsVisibleOnLoginPage = loginOptions.filter(tenantLoginOptionsService.isVisibleOnLoginPage);
  })();
Parameters :
Name Type Optional
loginOption ITenantLoginOption No
Returns : boolean

Properties

Readonly MANAGEMENT
Type : string
Default value : 'management'
Readonly ROLE_TENANT_MANAGEMENT_READ
Type : string
Default value : 'ROLE_TENANT_MANAGEMENT_READ'

Accessors

currentTenant
getcurrentTenant()

Returns current tenant

Returns : ICurrentTenant

results matching ""

    No results matching ""