存取控制原則端點
存取控制原則是將屬性集合在一起,以建立允許和不允許動作的陳述式。 這些原則可以是本機或全域,並且可以覆寫其他原則。 以屬性為基礎的存取控制API中的/policies
端點可讓您以程式設計方式管理原則,包括管理原則的規則相關資訊及其各自的主體條件。
/policies
端點混淆。快速入門
本指南中使用的API端點屬於屬性型存取控制API的一部分。 繼續之前,請先檢閱快速入門手冊,以取得相關檔案的連結、閱讀本檔案中範例API呼叫的手冊,以及有關成功呼叫任何Experience PlatformAPI所需必要標題的重要資訊。
擷取原則清單 list
向/policies
端點發出GET要求,以列出組織中的所有現有原則。
API格式
GET /policies
要求
以下請求會擷取現有原則的清單。
curl -X GET \
https://platform.adobe.io/data/foundation/access-control/administration/policies \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的回應會傳回現有原則的清單。
{
{
"id": "7019068e-a3a0-48ce-b56b-008109470592",
"imsOrgId": "{IMS_ORG}",
"createdBy": "{CREATED_BY}",
"createdAt": 1652892767559,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1652895736367,
"name": "schema-field",
"description": "schema-field",
"status": "inactive",
"subjectCondition": null,
"rules": [
{
"effect": "Deny",
"resource": "/orgs/{IMS_ORG}/sandboxes/xql/schemas/*/schema-fields/*",
"condition": "{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}",
"actions": [
"com.adobe.action.read",
"com.adobe.action.write",
"com.adobe.action.view"
]
},
{
"effect": "Permit",
"resource": "/orgs/{IMS_ORG}/sandboxes/*/schemas/*/schema-fields/*",
"condition": "{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}",
"actions": [
"com.adobe.action.delete"
]
},
{
"effect": "Deny",
"resource": "/orgs/{IMS_ORG}/sandboxes/delete-sandbox-adfengine-test-8/segments/*",
"condition": "{\"!\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"custom/\",{\"var\":\"resource.labels\"}]}]}",
"actions": [
"com.adobe.action.write"
]
}
],
"_etag": "\"0300593f-0000-0200-0000-62852ff80000\""
},
{
"id": "13138ef6-c007-495d-837f-0a248867e219",
"imsOrgId": "{IMS_ORG}",
"createdBy": "{CREATED_BY}",
"createdAt": 1652859368555,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1652890780206,
"name": "Documentation-Copy",
"description": "xyz",
"status": "active",
"subjectCondition": null,
"rules": [
{
"effect": "Permit",
"resource": "orgs/{IMS_ORG}/sandboxes/ro-sand/schemas/*/schema-fields/*",
"condition": "{\"!\":[{\"or\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"and\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}]}]}",
"actions": [
"com.adobe.action.read"
]
},
{
"effect": "Deny",
"resource": "orgs/{IMS_ORG}/sandboxes/*/segments/*",
"condition": "{\"!\":[{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"custom/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
],
"_etag": "\"0300d43c-0000-0200-0000-62851c9c0000\""
},
}
id
imsOrgId
createdBy
createdAt
createdAt
屬性會顯示在unix epoch時間戳記中。modifiedBy
modifiedAt
modifiedAt
屬性會顯示在unix epoch時間戳記中。name
description
status
active
還是inactive
。subjectCondition
subjectCondition
是套用至主旨屬性的類似查詢條件。rules
rules.effect
action
、condition
和resource
的值後產生的效果。 可能的值包括: permit
、deny
或indeterminate
。rules.resource
rules.condition
rules.action
read
、create
、edit
和delete
。依ID查詢原則詳細資訊 lookup
在要求路徑中提供原則ID以擷取個別原則的相關資訊時,向/policies
端點提出GET要求。
API格式
GET /policies/{POLICY_ID}
要求
以下請求會擷取個別原則的相關資訊。
curl -X GET \
https://platform.adobe.io/data/foundation/access-control/administration/policies/13138ef6-c007-495d-837f-0a248867e219 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的要求會傳回查詢原則ID的相關資訊。
{
"policies": [
{
"id": "7019068e-a3a0-48ce-b56b-008109470592",
"imsOrgId": "5555467B5D8013E50A494220@AdobeOrg",
"createdBy": "example@AdobeID",
"createdAt": 1652892767559,
"modifiedBy": "example@AdobeID",
"modifiedAt": 1652895736367,
"name": "schema-field",
"description": "schema-field",
"status": "inactive",
"subjectCondition": null,
"rules": [
{
"effect": "Deny",
"resource": "/orgs/5555467B5D8013E50A494220@AdobeOrg/sandboxes/xql/schemas/*/schema-fields/*",
"condition": "{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}",
"actions": [
"com.adobe.action.read",
"com.adobe.action.write",
"com.adobe.action.view"
]
},
{
"effect": "Permit",
"resource": "/orgs/5555467B5D8013E50A494220@AdobeOrg/sandboxes/*/schemas/*/schema-fields/*",
"condition": "{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}",
"actions": [
"com.adobe.action.delete"
]
},
{
"effect": "Deny",
"resource": "/orgs/5555467B5D8013E50A494220@AdobeOrg/sandboxes/delete-sandbox-adfengine-test-8/segments/*",
"condition": "{\"!\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"custom/\",{\"var\":\"resource.labels\"}]}]}",
"actions": [
"com.adobe.action.write"
]
}
],
"etag": "\"0300593f-0000-0200-0000-62852ff80000\""
}
]
}
id
imsOrgId
createdBy
createdAt
createdAt
屬性會顯示在unix epoch時間戳記中。modifiedBy
modifiedAt
modifiedAt
屬性會顯示在unix epoch時間戳記中。name
description
status
active
還是inactive
。subjectCondition
subjectCondition
是套用至主旨屬性的類似查詢條件。rules
rules.effect
action
、condition
和resource
的值後產生的效果。 可能的值包括: permit
、deny
或indeterminate
。rules.resource
rules.condition
rules.action
read
、create
、edit
和delete
。建立原則 create
若要建立新原則,請向/policies
端點發出POST要求。
API格式
POST /policies
要求
下列要求會建立名為的新原則: acme-integration-policy
。
curl -X POST \
https://platform.adobe.io/data/foundation/access-control/administration/policies \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"name": "acme-integration-policy",
"description": "Policy for ACME",
"imsOrgId": "{IMS_ORG}",
"rules": [
{
"effect": "Permit",
"resource": "/orgs/{IMS_ORG}/sandboxes/*",
"condition": "{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
]
}'
name
description
imsOrgId
rules
rules.effect
action
、condition
和resource
的值後產生的效果。 可能的值包括: permit
、deny
或indeterminate
。rules.resource
rules.condition
rules.action
read
、create
、edit
和delete
。回應
成功的請求會傳回新建立的原則,包括其唯一的原則ID和相關聯的規則。
{
"id": "c3863937-5d40-448d-a7be-416e538f955e",
"imsOrgId": "{IMS_ORG}",
"createdBy": "{CREATED_BY}",
"createdAt": 1652988384458,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1652988384458,
"name": "acme-integration-policy",
"description": "Policy for ACME",
"status": "active",
"subjectCondition": null,
"rules": [
{
"effect": "Permit",
"resource": "/orgs/{IMS_ORG}/sandboxes/*",
"condition": "{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
],
"_etag": null
}
id
name
rules
rules.effect
action
、condition
和resource
的值後產生的效果。 可能的值包括: permit
、deny
或indeterminate
。rules.resource
rules.condition
rules.action
read
、create
、edit
和delete
。依原則ID更新原則 put
若要更新個別原則的規則,請在要求路徑中提供您要更新之原則的ID時,向/policies
端點提出PUT要求。
API格式
PUT /policies/{POLICY_ID}
要求
curl -X PUT \
https://platform.adobe.io/data/foundation/access-control/administration/policies/8cf487d7-3642-4243-a8ea-213d72f694b9 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"id": "8cf487d7-3642-4243-a8ea-213d72f694b9",
"imsOrgId": "{IMS_ORG}",
"name": "test-2",
"rules": [
{
"effect": "Deny",
"resource": "/orgs/{IMS_ORG}/sandboxes/*",
"condition": "{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
]
}'
回應
成功的回應會傳回更新的原則。
{
"id": "8cf487d7-3642-4243-a8ea-213d72f694b9",
"imsOrgId": "{IMS_ORG}",
"createdBy": "{CREATED_BY}",
"createdAt": 1652988866647,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1652989297287,
"name": "test-2",
"description": null,
"status": "active",
"subjectCondition": null,
"rules": [
{
"effect": "Deny",
"resource": "/orgs/{IMS_ORG}/sandboxes/*",
"condition": "{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
],
"_etag": null
}
更新原則屬性 patch
若要更新個別原則的內容,請在要求路徑中提供您要更新之原則的ID時,向/policies
端點提出PATCH要求。
API格式
PATCH /policies/{POLICY_ID}
要求
下列要求會取代原則識別碼c3863937-5d40-448d-a7be-416e538f955e
中/description
的值。
curl -X PATCH \
https://platform.adobe.io/data/foundation/access-control/administration/policies/c3863937-5d40-448d-a7be-416e538f955e \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"operations": [
{
"op": "replace",
"path": "/description",
"value": "Pre-set policy to be applied for ACME"
}
]
}'
op
add
、replace
和remove
。path
value
回應
成功的回應會傳回查詢的原則識別碼和更新的說明。
{
"id": "c3863937-5d40-448d-a7be-416e538f955e",
"imsOrgId": "{IMS_ORG}",
"createdBy": "acp_accessControlService",
"createdAt": 1652988384458,
"modifiedBy": "acp_accessControlService",
"modifiedAt": 1652988384458,
"name": "acme-integration-policy",
"description": "Pre-set policy to be applied for ACME",
"status": "active",
"subjectCondition": null,
"rules": [
{
"effect": "Permit",
"resource": "/orgs/{IMS_ORG}/sandboxes/*",
"condition": "{\"or\":[{\"adobe.match_any_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]},{\"!\":[{\"adobe.match_all_labels_by_prefix\":[{\"var\":\"subject.roles.labels\"},\"core/\",{\"var\":\"resource.labels\"}]}]}]}",
"actions": [
"com.adobe.action.read"
]
}
],
"_etag": null
}
刪除原則 delete
若要刪除原則,請在提供您要刪除之原則的ID時,向/policies
端點提出DELETE要求。
API格式
DELETE /policies/{POLICY_ID}
要求
下列要求會刪除識別碼為c3863937-5d40-448d-a7be-416e538f955e
的原則。
curl -X DELETE \
https://platform.adobe.io/data/foundation/access-control/administration/policies/c3863937-5d40-448d-a7be-416e538f955e \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的回應會傳回HTTP狀態204 (無內容)和空白內文。
您可以嘗試對原則發出查詢(GET)請求以確認刪除。 您會收到HTTP狀態404 (找不到),因為原則已從管理中移除。