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?

1

There are 1 best solutions below

0
On

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": ""
}