问题
I'm using Atlassian Confluence REST API. I need to get Space permissions. I couldn't find any info on it in the documentation.
Does anyone know how to get these permissions?
回答1:
I can see virtually no documentation about this, however having looked at the Confluence REST API Browser, I've got a working example below. You have to be a Confluence admin, or space admin for the space...
POST: http://localhost:1990/confluence/rpc/json-rpc/confluenceservice-v2/getSpacePermissionSets
BODY: [ "ds" ]
RESPONSE:
[
{
"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
}
]
}
]
It's using the old JSON-RPC REST APIs which have been deprecated and will eventually be replaced. But when they are replaced, you can refactor, right?
来源:https://stackoverflow.com/questions/27128721/how-to-get-atlassian-confluence-space-permissions-by-rest-api