Write a role main rule

When the rule author doesn't have the claim

When you want to create a rule that uses a claim sent from the federation provider and the user editing the role/rule does not have this claim, then the rule must be constructed in a special way in order for the rule to validate.

Step-by-step guide

  1. Add/edit the role where you want to specify the rule
  2. Type the following script if you want to check if the user has the country claim set to SE:
return typeof country === "undefined" ? false : country === 'SE';

If you want to check a claim that can be either single valued or multi valued, you can use the following pattern (where you replace NameOfClaim with your claim):

var valueToCheck = 'Value';
return typeof NameOfClaim == 'undefined' ? false : NameOfClaim .Contains ? NameOfClaim .Contains(valueToCheck) : NameOfClaim == valueToCheck;

If you have ZervicePoint 1.9 or later, you can use the hasClaim function instead that works in both cases:

return user.hasClaim('country', 'SE');