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)
Parameters :
Name Type Optional
userService UserService No
appStateService AppStateService 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.

getCurrentTenantPreferredLoginOption
getCurrentTenantPreferredLoginOption()

Returns current tenant preferred login mode.

Returns : ITenantLoginOption
getCurrentUserLoginMode
getCurrentUserLoginMode()

Returns current user login mode.

getOauth2Option
getOauth2Option(loginOptions: ITenantLoginOption[])

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

Example

Example :

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

The list of all available tenant's login options.

Returns : ITenantLoginOption

Returns ITenantLoginOption.

Example

Example :

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

Returns tenant login option which is preferred.

Example

Example :

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

The list of all available tenant's login options.

Returns : ITenantLoginOption

Returns ITenantLoginOption.

Example

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

Example :

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

The tenant login option.

Example

Example :

(() => {
const basicLoginOptions = loginOptions.filter(tenantLoginOptionsService.isBasic);
})();
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

Example :

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

The tenant login option.

Example

Example :

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

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

Example

Example :

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

The tenant login option.

Example

Example :

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

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

Example

Example :

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

The tenant login option.

Example

Example :

(() => {
const loginOptionsVisibleOnLoginPage = loginOptions.filter(tenantLoginOptionsService.isVisibleOnLoginPage);
})();
Returns : boolean

Properties

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

Accessors

currentTenant
getcurrentTenant()

Returns current tenant

Returns : ICurrentTenant

results matching ""

    No results matching ""