Skip to content
On this page

Cbac API ​

EndpointMethodDescription
cbac:createPolicywebsocketCreate cbac policy
cbac:updatePolicywebsocketUpdate cbac policy
cbac:getPolicywebsocketGet cbac policy
cbac:listPolicieswebsocketList cbac policies
cbac:deletePolicywebsocketDelete cbac policy

Create cbac policy ​

Method: websocket

Endpoint: cbac:createPolicy

Description: Creates a new CBAC policy on a target entity (room, community, or group). Multiple independent policies can coexist on the same target — each with its own badge requirement and granted permission level. Requires manage permission on the target.

Valid grantedPermission values per target type:

  • room — room.view, room.comment, room.contribute, room.edit
  • community — community.join
  • group — group.join

Request:

{
    "data": {
        "networkId": string  // id of the network the target belongs to
        "targetType": string  // type of the target entity (room, community, or group)
        "targetId": string  // id of the target entity
        "badgeIds": [ string ]  // one or more badge ids required to gain access; must not be empty
        "badgeMatchMode": string  // how badges are evaluated: 'any' (one badge suffices) or 'all' (every badge required)
        "grantedPermission": string  // permission level granted when the user meets the badge requirement (must be a CBAC-grantable permission)
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "policy": {  // the CBAC policy
            "policyId": string
            "networkId": string
            "targetType": string
            "targetId": string
            "badgeIds": [ string ]
            "badgeMatchMode": string
            "grantedPermission": string
        }
    }
    "error": { "status": bool, "code": int, "message": string }
}

Update cbac policy ​

Method: websocket

Endpoint: cbac:updatePolicy

Description: Replaces an existing CBAC policy identified by policyId. Requires manage permission on the target.

Request:

{
    "data": {
        "policyId": string  // id of the policy to update
        "networkId": string  // id of the network the target belongs to
        "targetType": string  // type of the target entity (room, community, or group)
        "targetId": string  // id of the target entity
        "badgeIds": [ string ]  // one or more badge ids required to gain access; must not be empty
        "badgeMatchMode": string  // how badges are evaluated: 'any' (one badge suffices) or 'all' (every badge required)
        "grantedPermission": string  // permission level granted when the user meets the badge requirement (must be a CBAC-grantable permission)
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "policy": {  // the CBAC policy
            "policyId": string
            "networkId": string
            "targetType": string
            "targetId": string
            "badgeIds": [ string ]
            "badgeMatchMode": string
            "grantedPermission": string
        }
    }
    "error": { "status": bool, "code": int, "message": string }
}

Get cbac policy ​

Method: websocket

Endpoint: cbac:getPolicy

Description: Returns a single CBAC policy identified by policyId.

Request:

{
    "data": {
        "policyId": string  // id of the policy to retrieve or delete
        "networkId": string  // id of the network the target belongs to
        "targetType": string  // type of the target entity (room, community, or group)
        "targetId": string  // id of the target entity
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "policy": {  // the CBAC policy
            "policyId": string
            "networkId": string
            "targetType": string
            "targetId": string
            "badgeIds": [ string ]
            "badgeMatchMode": string
            "grantedPermission": string
        }
    }
    "error": { "status": bool, "code": int, "message": string }
}

List cbac policies ​

Method: websocket

Endpoint: cbac:listPolicies

Description: Returns all CBAC policies configured for a target entity.

Request:

{
    "data": {
        "networkId": string  // id of the network the target belongs to
        "targetType": string  // type of the target entity (room, community, or group)
        "targetId": string  // id of the target entity
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "policies": [{  // all CBAC policies configured for this target
            "policyId": string
            "networkId": string
            "targetType": string
            "targetId": string
            "badgeIds": [ string ]
            "badgeMatchMode": string
            "grantedPermission": string
        }]
    }
    "error": { "status": bool, "code": int, "message": string }
}

Delete cbac policy ​

Method: websocket

Endpoint: cbac:deletePolicy

Description: Removes a single CBAC policy identified by policyId. Requires manage permission on the target.

Request:

{
    "data": {
        "policyId": string  // id of the policy to retrieve or delete
        "networkId": string  // id of the network the target belongs to
        "targetType": string  // type of the target entity (room, community, or group)
        "targetId": string  // id of the target entity
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "error": { "status": bool, "code": int, "message": string }
}