Keycloak KeyClope如何使用AdminRESTAPI将现有权限与新资源关联

Keycloak KeyClope如何使用AdminRESTAPI将现有权限与新资源关联,keycloak,keycloak-rest-api,Keycloak,Keycloak Rest Api,在Kydape中,他们解释了如何在创建资源时创建新权限。我的问题是,我们如何使用rest api将现有权限与新资源关联?文档中缺少这一部分 到目前为止我试过这个 curl -X POST \ http://localhost:8180/auth/realms/photoz/authz/protection/uma-policy/{resource_id} \ -H 'Authorization: Bearer '$access_token \ -H 'Cache-Control: n

在Kydape中,他们解释了如何在创建资源时创建新权限。我的问题是,我们如何使用rest api将现有权限与新资源关联?文档中缺少这一部分

到目前为止我试过这个

curl -X POST \
  http://localhost:8180/auth/realms/photoz/authz/protection/uma-policy/{resource_id} \
  -H 'Authorization: Bearer '$access_token \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "Any people manager",
        "description": "Allow access to any people manager",
        "scopes": ["read"],
        "roles": ["people-manager"]
}'
对于资源,已使用
“id”创建了一个新权限:“c7bfa514-ad26-474f-862e-f609342d73b7”

现在,假设我有另一个资源,我想将上面新创建的策略与该资源关联,我们称之为resource2

为此,我尝试了类似的方法

curl -X POST \
      http://localhost:8180/auth/realms/photoz/authz/protection/uma-policy/resource2ID \
      -H 'Authorization: Bearer '$access_token \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json' \
      -d '{
            "id":"c7bfa514-ad26-474f-862e-f609342d73b7"
    }'
但我得到了回应

{"error":"invalid_request","error_description":"Newly created uma policies should not have an id"}
通过RESTAPI将现有策略与多个资源关联的正确方法是什么(这在keyclaok ui中是可能的)