# Step 1 — Alice creates a conversation (she becomes the owner)
CONV_JSON=$(mka1 llm conversations create \
--body '{ "metadata": { "project": "acme" } }' \
-H 'X-On-Behalf-Of: user_alice' \
-o json)
RESOURCE_ID=$(echo "$CONV_JSON" | jq -r '.id')
# Step 2 — Alice grants reader access to Bob
mka1 permissions llm grant \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--user-id user_bob \
--role reader \
-H 'X-On-Behalf-Of: user_alice'
# Step 3 — Check Bob has reader access (allowed: true)
mka1 permissions llm check \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--role reader \
-H 'X-On-Behalf-Of: user_bob'
# Step 3b — Check Bob does NOT have writer access (allowed: false)
mka1 permissions llm check \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--role writer \
-H 'X-On-Behalf-Of: user_bob'
# Step 4 — Bob tries to grant (returns 403 Forbidden)
mka1 permissions llm grant \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--user-id user_charlie \
--role reader \
-H 'X-On-Behalf-Of: user_bob'
# Step 5 — Alice revokes Bob's access
mka1 permissions llm revoke \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--user-id user_bob \
--role reader \
-H 'X-On-Behalf-Of: user_alice'
# Step 6 — Verify Bob is now denied (allowed: false)
mka1 permissions llm check \
--resource-type conversation \
--resource-id "$RESOURCE_ID" \
--role reader \
-H 'X-On-Behalf-Of: user_bob'