Setting Conditions on App Properties
App property conditions let you control the value of an app property based on a specific user or role. For example, you can set the value of an app property based on a user name or based on the role that contains the user.
You can add a condition to any app property defined at the server level as long as the app property has the
For more information on defining app properties, see App Properties Overview.
This document contains the following sections:
About app property conditions
Shown below is an example app-scope level properties.xml file that defines a single app property named "greeting" with a default value of "Welcome!":
Notice that the
By default, on a successful log in, all clients receive the same value for a client app property. However, what if you want to personalize this message so that different users see a different message?
Add conditions to the app property to control its value based on user name or user role. For example, add a condition to the app property to display the message "Welcome Dave!" for the user dsmith. Or, create a condition to display "Welcome Admin!" to all users in the Admin role.
To add a condition, use the Akula Command-line or make a request to an endpoint on the Akula Server. The following sections describe how to use the Akula Command-line. For more information on the Akula Command-line, see Using the Akula Command-line Management Utility.
For more information on using endpoints, see App Property Management REST API.
Attributes of a condition
An app property can have one or more conditions applied to it, where each condition is composed of the following attributes:
Specifies the type of the condition as either:
|Specifies the authentication realm for the user. This value is required for conditions of type |
Specifies the name of a user, if
Specifies the value of the app property when the
Specifies the position of the condition in the list of all conditions for the app property, where the first position is at an index of 0. Position is important because an app property can have multiple conditions assigned to it. If a user matches multiple conditions, then the Akula Server applies the condition at the lowest position. That means a condition at position 1 takes precedence over a condition at position 2.
Adding a condition on an app property
To see the information about an app property, including any conditions, use the following command in the Akula Command-line to list all the app properties for an app scope:
where ToDo is the name of the app scope. For the "greeting" property, you will see the following:
Notice that the list of
OverrideConditions is empty.
To add a condition to an app property, use the
addpropertycondition command. The
addpropertycondition has the following syntax:
addpropertycondition <scope> <key> <type> <condition> <value> [-p position] [-r realm]
where key is the name of the app property. All values are required except for position and realm. The realm value is required only for conditions of type
user, and position is always optional.
For example, to add a condition that sets the value of the "greeting" app property for the user dsmith, use the following command:
To make sure that this condition is at position 1, use the following command:
If there is already a condition at position 1, then the position of the existing condition and the position of all other conditions at a higher position are incremented by one.
When you create a new condition, the Akula Server creates a unique ID for the condition. You must know the condition ID to modify or delete the condition. To see the ID, display the list of app properties for the app scope by using the command:
The property now appears as:
Updating a condition
To update a condition, use the
updatepropertycondition command, which has the following syntax:
<scope> <key> <condition_id> [-v value] [-p position] [-c condition] [-t type] [-r realm]
The scope, key, and condition_id attributes are required and all other values are optional. Specify the optional attributes in any order by prefixing them with a flag. Therefore, if you only want to set position, prefix it with the
-p flag, as the following example shows:
Deleting a condition
To delete a condition, use the
deletepropertyconditions command, which has the following syntax:
deletepropertyconditions <scope> <key> <condition_id> [condition_id]...
where you can specify one or more condition IDs. For example, to remove the condition with an ID of 5 from the "greeting" app property, use the following command: