Skip to main content Skip to footer

How To Use Organization and User Contexts in a Connection String

Background:

This article will go through how to use Organization and User contexts in the connection strings of the data sources you can connect to in Wyn. The most common use case for this is for multi-tenant data.

Creating an organization context value:

Go to the organization panel on the admin portal and look for this item.

You will need to create organization contexts by selecting the add property button.

When in the creation you will be able to give it a dame, and 2 properties.

Required will make it so that the organization must have this context filed in their schema.

Multi valued will make it so that the context can have multiple values. (Not useful for this use case.)

 

After that you are able to go out and add values to the contexts. As well as determining if the sub organizations can edit and view the contexts of the main organizations values.

Creating User Contexts:

Navigate to the Custom Property section of the accounts area of the admin portal.

When on that tab you will see an Add Property button. On clicking you will go into the creation.

In this you will be able to give the property a Name, along with other permissions and value controls.

These can be edited in the main screen again by selecting the three dot more options area at the end of the bar.

After that you can edit it on a user by user basis on the admin portals user panel.

First option in picture is an item with available values and the second has multiple values enabled. The last 2 are the standard single string that can be entered in manually.

These values also are visible from the user page as well once entered.

Calling the Contexts:

To add an Organization context you will use #{context name}.

Below is an example of how this will work with the sample calling the db context. This is the most standard use case as this will switch between the tenants and give each of your tenants different data when they view anything made with this data source.

To use the user context you will do similar with the @{value} format. The most common use case for these would be if you monitor your database by who access it with using values for Username and Password areas of the connection string.

Victor Stahlman

Victor is a Product Consultant for MESCIUS' Wyn Enterprise Platform. He works in supporting customer through their set up and extended use of Wyn, as well as focusing on technical writing through expanding the Knowledge Base.
Victor graduated with a Bachelor's in Computer Information Sciences and has always been helping his peers and now MESCIUS clients in understanding, fixing, and using programs. When he is not on the computer, he is working on remodeling projects for his house, is out in the garden, or on the river.