如何通过REST API获得Atlassian Confluence Space权限?

时间:2014-11-25 14:00:58

标签: java confluence confluence-rest-api

我正在使用Atlassian Confluence REST API。我需要获得Space权限。我在文档中找不到任何关于它的信息。

有谁知道如何获得这些权限?

1 个答案:

答案 0 :(得分:6)

我几乎看不到关于此的文档,但是看过Confluence REST API浏览器,我在下面有一个工作示例。您必须是Confluence管理员或空间管理员...

发布: http://localhost:1990/confluence/rpc/json-rpc/confluenceservice-v2/getSpacePermissionSets

BODY: [ "ds" ]

<强>响应:

[
  {
    "type": "SETSPACEPERMISSIONS",
    "spacePermissions": [
      {
        "type": "SETSPACEPERMISSIONS",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "EXPORTSPACE",
    "spacePermissions": [
      {
        "type": "EXPORTSPACE",
        "userName": null,
        "groupName": null
      },
      {
        "type": "EXPORTSPACE",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "EXPORTSPACE",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "SETPAGEPERMISSIONS",
    "spacePermissions": [
      {
        "type": "SETPAGEPERMISSIONS",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "SETPAGEPERMISSIONS",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "REMOVEMAIL",
    "spacePermissions": [
      {
        "type": "REMOVEMAIL",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "REMOVEMAIL",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "REMOVEMAIL",
        "userName": null,
        "groupName": null
      }
    ]
  },
  {
    "type": "REMOVEBLOG",
    "spacePermissions": [
      {
        "type": "REMOVEBLOG",
        "userName": null,
        "groupName": null
      },
      {
        "type": "REMOVEBLOG",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "REMOVEBLOG",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "EXPORTPAGE",
    "spacePermissions": [
      {
        "type": "EXPORTPAGE",
        "userName": null,
        "groupName": null
      },
      {
        "type": "EXPORTPAGE",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "EXPORTPAGE",
        "userName": null,
        "groupName": "confluence-users"
      }
    ]
  },
  {
    "type": "REMOVEATTACHMENT",
    "spacePermissions": [
      {
        "type": "REMOVEATTACHMENT",
        "userName": null,
        "groupName": null
      },
      {
        "type": "REMOVEATTACHMENT",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "REMOVEATTACHMENT",
        "userName": null,
        "groupName": "confluence-users"
      }
    ]
  },
  {
    "type": "CREATEATTACHMENT",
    "spacePermissions": [
      {
        "type": "CREATEATTACHMENT",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "CREATEATTACHMENT",
        "userName": null,
        "groupName": null
      },
      {
        "type": "CREATEATTACHMENT",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "VIEWSPACE",
    "spacePermissions": [
      {
        "type": "VIEWSPACE",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "VIEWSPACE",
        "userName": null,
        "groupName": null
      },
      {
        "type": "VIEWSPACE",
        "userName": null,
        "groupName": "confluence-users"
      }
    ]
  },
  {
    "type": "EDITBLOG",
    "spacePermissions": [
      {
        "type": "EDITBLOG",
        "userName": null,
        "groupName": null
      },
      {
        "type": "EDITBLOG",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "EDITBLOG",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "REMOVEPAGE",
    "spacePermissions": [
      {
        "type": "REMOVEPAGE",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "REMOVEPAGE",
        "userName": null,
        "groupName": null
      },
      {
        "type": "REMOVEPAGE",
        "userName": null,
        "groupName": "confluence-users"
      }
    ]
  },
  {
    "type": "REMOVECOMMENT",
    "spacePermissions": [
      {
        "type": "REMOVECOMMENT",
        "userName": null,
        "groupName": null
      },
      {
        "type": "REMOVECOMMENT",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "REMOVECOMMENT",
        "userName": null,
        "groupName": "confluence-administrators"
      }
    ]
  },
  {
    "type": "EDITSPACE",
    "spacePermissions": [
      {
        "type": "EDITSPACE",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "EDITSPACE",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "EDITSPACE",
        "userName": null,
        "groupName": null
      }
    ]
  },
  {
    "type": "COMMENT",
    "spacePermissions": [
      {
        "type": "COMMENT",
        "userName": null,
        "groupName": "confluence-users"
      },
      {
        "type": "COMMENT",
        "userName": null,
        "groupName": "confluence-administrators"
      },
      {
        "type": "COMMENT",
        "userName": null,
        "groupName": null
      }
    ]
  }
]

它使用旧的JSON-RPC REST API,这些API已被弃用并最终将被替换。但是当它们被替换时,你可以重构,对吧?