Restrictions endpoint returns statusCode 404

110 views
Skip to first unread message

si...@k15t.com

unread,
Dec 21, 2016, 11:50:13 AM12/21/16
to Atlassian Connect Dev
Hi all,

I'm trying to answer the question: "Is the current user allowed to update a confluence page". I'm using this REST endpoint:

/rest/api/content/{id}/restriction/byOperation/{operationKey}/user?key={userKey}

The documentation states that the endpoint should return a boolean value (true/false) in case of success. However, the response body
is empty instead.
 
If the page has no restrictions set then the endpoint responds with statusCode 404. Shouldn't it return with a boolean value in this case too?

cheers,

Simon

Einar Pehrson

unread,
Dec 30, 2016, 7:09:37 AM12/30/16
to atlassian-...@googlegroups.com
Hi Simon,

regarding the /restriction/byOperation, I agree that both the behavior and documentation of that API leaves a bit to be desired. I've raised CE-868 for that.

I don't believe there currently is an API to retrieve the information you're looking for. As described in Permissions and restrictions and Page Restrictions in the Confluence documentation, Confluence permissions operate on multiple levels. And from what I can tell, the REST API (as well as the legacy RPC API's) are currently modelled around those different levels of permissions. And I wouldn't recommend trying to infer the answer to your question from those individual pieces of data.

But what is your use case? Do you need a REST API, or would a web fragment condition be more appropriate?

Cheers!
Einar



--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

si...@k15t.com

unread,
Jan 10, 2017, 3:24:40 AM1/10/17
to Atlassian Connect Dev
Hi Einar,

thank you for your response and opening an issue!

My use case is, that I want to display a form inside a dynamic content macro if the current user has permissions to edit the content properties of the page. I looked
through the available conditions but didn't find anything that fits my needs.
However, I solved the problem with a small workaround now.

Thanks again!

Simon

si...@k15t.com

unread,
Jan 19, 2017, 4:47:05 AM1/19/17
to Atlassian Connect Dev
Hi Einar,

I had a chat with a colleague this week and we came to the conclusion, that having a web fragment condition to check these permissions would
really be awesome. Some other plugins we are developing could also benefit from this. Do you think there is a chance that such a condition could
be added?

Simon

On Friday, December 30, 2016 at 1:09:37 PM UTC+1, Einar Pehrson wrote:

Einar Pehrson

unread,
Jan 19, 2017, 6:06:12 AM1/19/17
to atlassian-...@googlegroups.com
Hi Simon,

my question about web fragment conditions was a bit leading, actually :)

In the upcoming release Connect 1.2.23, we've added a set of conditions to check permissions against Confluence spaces, pages, custom, content, attachments and comments. They are documented on the latest version of our Conditions page.

Cheers!
Einar

To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Simon Kusterer

unread,
Jan 24, 2017, 4:36:47 AM1/24/17
to Atlassian Connect Dev
Hi Einar,

oh, that's awesome! Thanks :-)

Simon
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

si...@k15t.com

unread,
Feb 10, 2017, 5:54:30 AM2/10/17
to Atlassian Connect Dev
Hi Einar,

in the meantime I was able to test these new conditions. In my particular case I need them inside a a byline-dialog and inside the view of a dynamic-content-macro.
So I've attached an inline-condition to the iframe url which looks like this: &hasPageWritePermissions={condition.has_page_permission(permission=EDIT)}

In case of the byline-dialog it works as expected, hasPageWritePermissions is set to 'true'.
However, in case of the dynamic-content-macro, hasPageWritePermissions is set to 'false'.

Are these conditions supposed to work inside of dynamic-content-macros? If not, I think the value should be set to an empty string
instead of 'false' to avoid confusion.

cheers,

Simon

Einar Pehrson

unread,
Feb 10, 2017, 6:11:38 AM2/10/17
to atlassian-...@googlegroups.com
Hi Simon,

I've raised this as CE-929 for the Confluence team to look at.

As a possible workaround, I would suggest you try defining your dynamic content macro twice: once with the condition and once with the condition inverted.

Cheers!
Einar

Simon
Simon
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages