Skip to main content
View as Markdown

Rule Conditions - Content Management

Rule Conditions​

Condition Types​

Condition ObjectTypeType ValueDescription
KalturaIpAddressConditionIP_ADDRESS (3)Match by IP address or CIDR range
KalturaCountryConditionCOUNTRY (2)Match by country code (derived from IP)
KalturaSiteConditionSITE (4)Match by referring domain (wildcards supported)
KalturaUserAgentConditionUSER_AGENT (5)Match by user-agent string (regex supported)
KalturaAuthenticatedConditionAUTHENTICATED (1)Require valid KS with specific privileges
KalturaFieldMatchConditionFIELD_MATCH (6)Match text field against values
KalturaFieldCompareConditionFIELD_COMPARE (7)Compare numeric field against values
KalturaMatchMetadataConditionmetadata.FieldMatchMatch metadata XML field text against values
KalturaCompareMetadataConditionmetadata.FieldCompareCompare metadata XML field number against values

All conditions support a not boolean field -- when true, the condition matches when the test FAILS (logical negation).

IP Address Condition​

# Block all IPs except internal network
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaIpAddressCondition" \
-d "accessControlProfile[rules][0][conditions][0][not]=true" \
-d "accessControlProfile[rules][0][conditions][0][values][0][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][0][value]=192.168.1.0/24"

Country Condition​

# Block viewers outside US and Canada
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaCountryCondition" \
-d "accessControlProfile[rules][0][conditions][0][not]=true" \
-d "accessControlProfile[rules][0][conditions][0][values][0][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][0][value]=US" \
-d "accessControlProfile[rules][0][conditions][0][values][1][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][1][value]=CA"

Site/Domain Condition​

# Allow only from publisher.com and subdomains
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaSiteCondition" \
-d "accessControlProfile[rules][0][conditions][0][not]=true" \
-d "accessControlProfile[rules][0][conditions][0][values][0][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][0][value]=*.publisher.com"

User Agent Condition​

# Match iPad devices (regex)
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaUserAgentCondition" \
-d "accessControlProfile[rules][0][conditions][0][values][0][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][0][value]=.*iPad.*"

Authenticated Condition​

# Require valid KS
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaAuthenticatedCondition"

This condition validates at the entry level when assigned to entry-specific access control.

Metadata Conditions​

Match or compare values from a custom metadata profile's XML fields. Metadata conditions use profileId (the metadata profile ID) and xPath (the field path within the XML).

xPath formats:

  • Full path: /metadata/myElementName
  • Local-name function: /*[local-name()='metadata']/*[local-name()='myElementName']
  • Short form: myElementName (searched as //myElementName)

Match metadata text field:

# Block if AudioLanguage is NOT French
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaMatchMetadataCondition" \
-d "accessControlProfile[rules][0][conditions][0][xPath]=AudioLanguage" \
-d "accessControlProfile[rules][0][conditions][0][profileId]=$METADATA_PROFILE_ID" \
-d "accessControlProfile[rules][0][conditions][0][not]=true" \
-d "accessControlProfile[rules][0][conditions][0][values][0][objectType]=KalturaStringValue" \
-d "accessControlProfile[rules][0][conditions][0][values][0][value]=French"

Compare metadata numeric field (scheduling):

# Allow if current time >= entry's ipadSunrise metadata field
-d "accessControlProfile[rules][0][conditions][0][objectType]=KalturaCompareMetadataCondition" \
-d "accessControlProfile[rules][0][conditions][0][comparison]=4" \
-d "accessControlProfile[rules][0][conditions][0][xPath]=ipadSunrise" \
-d "accessControlProfile[rules][0][conditions][0][profileId]=$METADATA_PROFILE_ID" \
-d "accessControlProfile[rules][0][conditions][0][value][objectType]=KalturaTimeContextField"

Comparison operators: 1=LESS_THAN, 2=LESS_THAN_OR_EQUAL, 3=GREATER_THAN, 4=GREATER_THAN_OR_EQUAL, 5=EQUAL

Field Match and Compare Conditions​

For generic field matching (not metadata-specific), use KalturaFieldMatchCondition and KalturaFieldCompareCondition. These use field objects:

String field implementations:

  • KalturaCountryContextField -- current request's country
  • KalturaIpAddressContextField -- current request's IP
  • KalturaUserAgentContextField -- current request's user agent
  • KalturaUserEmailContextField -- current session's user email

Integer field implementations:

  • KalturaTimeContextField -- current server time (Unix timestamp)