Page History
Yellowfin supports a multi-tenant structure through the creation of Client Organizations. You can read about Client Organizations here.
A common integration scenario is to create new clients programmatically. This could be valid in a SaaS scenario where a new client has been onboarded. The specific code that handles this in the host application could be modified to also create a corresponding Yellowfin Client Organization at the same time.
Another common scenario is when a new user is created in the host application. If the user needs to be attached to an existing Tenant, then Yellowfin services can be used to associate that user with a corresponding Client Organization.
Creating a new Client Organization
A new Client Organization can be created using the POST /api/orgs (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/createOrg) end-point. This end-point accepts the following payload:
{
"clientRefId": "CLIENT5",
"name": "Client 5",
"defaultTimezone": "AUSTRALIA/SYDNEY",
"customStylePath": "client5stylePath"
}
The clientRefId attribute is the primary identifier for the new tenant. The name attribute is the display name for the new tenant. The defaultTimezone attribute specifies the timezone for the new tenant, but this is not mandatory. A tenant will inherit the primary organization’s timezone if this is not set. The customStylePath defines a directory where custom styles and images will be stored for this tenant. This is not mandatory.
The following code examples create a new Client Organization:
Java | C# | Go | JavaScript | PHP | Python
List all Tenants / Client Organizations
To list all tenants within a Yellowfin instance use the GET /api/orgs end-point (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/getOrgs). This lists all tenants and their properties. This can be used to find a Client Organization by other identifiers, like Client Name.
These examples list all tenants from the Yellowfin instance:
Java | C# | Go | JavaScript | PHP | Python
Grant access to a Tenant for a User
A user can be given access to a tenant using the POST /api/orgs/{tenantId}/user-access end-point (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/addOrgUserAccess ), where tenantId is the integer identifier for the tenant / client organization.
The required payload for the POST /api/orgs/{tenantId}/user-access end-point is:
{
"userId": {userIpId}
}
Where {userIpId} is the integer identifier for a user.
The following code examples grant access to a client organization (identified by its clientOrgRef code) to a user (identified by their username):
Java | C# | Go | JavaScript | PHP | Python
Removing access from a Tenant for a User
A user's access can be revoked from a tenant using the DELETE /api/orgs/{tenantId}/user-access/{userIpId) end-point (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/removeOrgUserAccess ), where tenantId is the integer identifier for the tenant / client organization, and {userIpId} is the integer identifier for a user.
The following code examples revoke access from a client organization (identified by its clientOrgRef code) for a user (identified by their username):
Java | C# | Go | JavaScript | PHP | Python
List all the Users who have access to a Tenant
A list of users who have access to a tenant can be retrieved with the GET /api/orgs/{tenantId}/user-access/ end-point (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/getOrgUserAccessList ), where tenantId is the integer identifier for the tenant / client organization.
The following code examples list the users who have access to a specific client organization (identified by its clientOrgRef code):
Java | C# | Go | JavaScript | PHP | Python
Delete a Tenant
Deleting a tenant can be achieved with the DELETE /api/orgs/{tenantId} end-point (https://developers.yellowfinbi.com/dev/api-docs/current/#operation/deleteOrg ), where tenantId is the integer identifier for the tenant / client organization.
The following code examples delete a specific client organization (identified by its clientOrgRef code):
Java | C# | Go | JavaScript | PHP | Python
Custom Styling a Tenant
When creating a Client Organization a custom styling folder can be specified. The specified client folder can be created inside the Yellowfin/appserver/webapps/ROOT/customcss directory. Any stylesheets created in this directory will be applied to the Client Organization.
The custom folder name can be assigned manually through the administration interface or specified via the model when administering the Client via the REST API.
Any styles defined in the stylesheet directory will override the default Yellowfin styles. For example this CSS overrides some of the default CSS variables:
When logging into the associated client organization the overridden styles are applied:-