Framework: UserContext - akumina/AkuminaTraining GitHub Wiki

Overview

The UserContext is an object accessible throughout the Akumina Foundation Site that stores information about the current User. The UserContext object is populated with data about the current user retrieved via the Microsoft Graph API. As of 4.0.0.0, this data is drawn from an AppManager endpoint that caches data from the Microsoft Graph API. User Context

Viewing your User Context object

To view all properties currently stored within your UserContext simply type the following javascript line into your console on a site with Digital Workplace Core deployed.

Akumina.Digispace.UserContext

A JSON Object will be returned with your Configuration Context properties

Retrieving Data

We can retrieve data from a UserContext property by calling the Akumina.Digispace.UserContext object followed by the name of the desired property. Use the example below as a model:

//Get the login name property
var property = Akumina.Digispace.UserContext.LoginName;

//Display in console
console.log(property);

Storing Data

We can store data in a UserContext property by calling the Akumina.Digispace.UserContext object followed by the name of the desired property. Use the example below as a model:

//Assign data to a property
//We can create our own property here
var customProperty = "UserContext is FUN";
Akumina.Digispace.UserContext.OurProperty = customProperty;

//Display in console
console.log(Akumina.Digispace.UserContext.OurProperty);