Visibility of attachments without logging in

Hello Devs :slight_smile:

I’m using xWiki 14.10.19 and I am also using the default xWiki API in order to get an attachment.

If I am logged into the Wiki, I can see any attachment of any page without any problem.

But I want anyone, without being logged in, to be able to see this attachment, no matter if it is an image, video, audio… Etc

Since I am using this API to be able to send that attachment to another application and that the attachments that the Wiki has, can be visualized in another third party application, that are calling to my API to obtain the attachment of a page.

Is there a way to do this?

I was reading this documentation, I tried it and it didn’t work for me, although I don’t think it satisfies what I intend to do:

Any help or information would be appreciated!

Best regards and thank you very much.

Then you need to make sure you have set rights so that “guest” can “view” your page containing the attachments.

I’m not sure I understand what you mean. You can certainly use the XWiki REST API to get attachments of a wiki page. See https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HAttachmentsresources

Thanks

Thank you for your response :slight_smile:

The idea is that anyone can “see” the attachments and the user does not have to have an account.

For example, if a user wants to upload an attachment, he/she will have to log in to the Wiki and perform the process.
But, what I want to implement is that any user can see the attachments without logging in. (Only see it, not create it)

I developed an API apart from the xWiki one, in order to obtain the attachments that my Wiki contains, which are only images and videos, so if from that API I want to obtain the attachments, it would look like this:

If any user accesses that URL, can see the content of it, only when logged in. but I need that, without having to log into the Wiki, any user should be able to see the image/video.

Currently, if I try to access that URL, I get the following:
image

But what I need, is to see the image that has the Wiki, without asking me to log in like this:

I have also already read the documentation you share with me, in fact this is how I get the attachments and their respective URL.

I appreciate any help

Yes, that’s exactly what I mentioned above: you need to give “view” rights to the “Guest” user (ie users who are not logged in). And don’t give “edit” rights to “Guest” (so that only logged in users can edit/create).

Inside my Wiki, I don’t have a “guest” group, only the default ones (xWikiAllGroup, xWikiAdminGroup) and some custom ones, but I don’t need them for this.

How can I assign “view” permissions to a “guest” group?

These are the only configurations I know of to be able to manage the display of pages within the Wiki:

Also, these attachments are supposed to be accessible to anyone, you don’t have to have an account within the Wiki or belong to a Wiki group, the only relevant thing, is that the attachments can always be viewed.

How can I achieve this?

it’s not a group, it’s a user. You need to click on “users”.

EDIT: see also https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Access%20Rights/#HOpenWiki

2 Likes

Hi,

Actually, looking at your screenshot, you have explicitly checked the box “Prevent unregistered users from viewing pages, regardless of the page rights”.
With this setting, it makes sense that attachments are not accessible for guests on your instance.

1 Like

You are absolutely right, I only gave permissions to groups, but I didn’t realize that there was an option for “users” in general.

Now it works correctly.

Thank you very much for your help! :slight_smile: