Madhuri
Madhuri

Reputation: 1

I am writing a ALFA policy for a case where I need to assign a value as empty string in my code. How to define empty string array

I am writing a alfa policy with the below condition where documentpackage status is a set of array values which will be empty in this policy. As of now to make it pass I have tried giving empty space (as null is not accepted by this policy.)

      condition
      user.abac.bc_orgrole == "se"

     && action.newobject.DocumentPackageStatus == ''

How I can define this empty string?

Upvotes: 0

Views: 137

Answers (1)

Mark Berg
Mark Berg

Reputation: 91

You can use the stringBagSize function to check how many values are in an attribute. If it is empty then the size will be zero:

stringBagSize(action.newobject.DocumentPackageStatus) == 0 

Note that if you are including the attribute action.newobject.DocumentPackageStatus in the request even if it does not have a value you must do so like this so it will be empty:      

{
    "AttributeId": "action.newobject.DocumentPackageStatus",
    "Value": []
}

if you define it like this it will have a bagSize of 1 and the value of an empty string:

{
    "AttributeId": "action.newobject.DocumentPackageStatus",
    "Value": ""
}

Upvotes: 1

Related Questions