Skip to main content

Feature Policy 🆕

A feature policy variable contains information about which features in the Web Portal that users can see

Introduction​

Feature Policy variables are used to restrict access to certain features within the platform, thereby focussing users on the tasks they need to perform.

caution

Feature policies only change what the Web Portal shows, they are not a security control. To restrict access to data, use security policies.

For how feature policies are combined and more examples, see Feature Policies.

Defining a Feature Policy​

Below is a table with all the properties of a feature policy:

NameTypeExampleDescription
_idStringRunAllReportsThe unique id for this policy
categoryStringTeamUsersAn optional category used for filtering policies
descriptionStringMy test policyA descriptive name for the policy
enabledBooleantrueTrue if it is enabled, false to disable it, by default the policy is enabled
denyBooleantrueBy default, all features are available to everyone, so you need to set this to true to deny access to features
membersListuser@company.comThe user emails or policy user groups this policy applies to, or * for everyone (Azure Active Directory group id's are not used by feature policies)
featuresList["scripts"]The list of features that this policy applies to

Methods​

A policy has the following methods:

NameDescriptionReturn Type
addMember(name)Adds a member to this policyvoid
removeMember(name)Removes a member from this policyvoid

Example policy definition:

{
"_id": "HideScripts",
"category": "TradingTeam",
"description": "Hide Scripts menu item from users",
"deny": true,
"members": [
"user@company.com"
],
"features": [
"scripts"
],
"enabled": true
}

Portal Feature Names​

The following table shows the names of the features for each portal item:

NamePortal Item
masterDataMaster Data
dataData
eventsEvents
smartDataSmart Data
geoDataGEO Data
reportsReports
curvesCurves
datasetsDatasets
processesprocesses
executionsExecutions
processTimelineProcess Timeline
dataPackagesData Packages
queuesQueues
typesTypes
calendarsCalendars
scriptsScripts
dashboardsDashboards
alertsAlerts
groupsGroups

Extensions can also add tabs and views with their own feature names, e.g. odsl.aggregator.report for the Aggregator tab on the Reports screen. Use these names in a feature policy in the same way.

How Feature Policies are Combined​

  1. Start from the features switched on for your company.
  2. Every enabled allow feature policy the user is a member of switches its features on.
  3. Every enabled deny feature policy the user is a member of switches its features off.

Deny always wins. When your company is onboarded, a feature policy called EnergyUserFeatures gives everyone the standard menu items.

Updating, Finding and Deleting Feature Policies​

Saving a feature policy​

To save a feature policy in OpenDataDSL code, use the save command as follows:

HideScripts = FeaturePolicy()
HideScripts.description = "Hide Scripts menu item from users"
HideScripts.features = ["scripts"]
HideScripts.addMember("user:security:policy:BusinessUsers")
HideScripts.deny = true
HideScripts.enabled = true
save HideScripts

Listing feature policies​

To find feature policies, you use the ODSL find command, e.g.

policies = find ${policy} where _type="FeaturePolicy"

You can use the unique keyword to just get all the ids of your policies, e.g.

find unique _id from ${policy} where _type="FeaturePolicy"

Retrieving a specific feature policy​

To get a specific named feature policy, you use the policy active variable. You can then examine the information on the policy, e.g.

p = ${policy:"HideScripts"}
print p.description

Disabling a feature policy​

You can disable a feature policy by setting the enabled flag to false, e.g.

p = ${policy:"HideScripts"}
p.enabled = false
save p

Deleting a feature policy​

To delete a feature policy, you issue the delete command, e.g.

delete ${policy:"HideScripts"}