Very easy!…
- Insert the HTML Macro
- Inside the Macro put this code:
<button class="create-dialog-create-button aui-button aui-button-primary" tabindex="100" onclick="javascript:location.href='/wiki/pages/createblogpost.action?spaceKey=SPACE_KEY';">Create Blog</button>
Can you also set restrictions on the new blog post via that javascript? For e.g. a Confluence group?
LikeLiked by 1 person
Hi Patrick, yes you can use Javascript to query the REST API for the user groups and validate it.
Example with JIRA REST to obtain the groups of the user:
you can see the Confluence REST options here:
https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/?_ga=2.201438101.509108005.1515055286-1667334152.1507881432
The methods are these:
Get user
GET /rest/user
Get anonymous
GET /rest/user/anonymous
Get current
GET /rest/user/current
Get groups
GET /rest/user/memberof
Regards
LikeLike
Hi, what I meant was add restrictions to the blog inside that html macro. So somewhere in
Create Blog
add restrictions so that only a certain group can see the blog that will be created.
LikeLike
Somwhere in the button class in the html macro.
LikeLike
Yes you can add the tag and insert the javascript code of my latest response. Then you must modify the code to obtain the REST data from Confluence and not for JIRA (but if you use SSO you can use the code as is and obtain the groups of the current user from the JIRA REST API).
Regards
LikeLike