Is there a functionality to import xar as user?

Hello.

Currently, a user with “admin” right on a specific “Page and childen” can export a document/space as XAR ( and not just HTML ) which is good.

We are looking if there is a way for our users to import XWiki page as a XAR in the same way than the export feature provided

Screenshot 2021-07-28 at 11.18.30

Maybe here an “import” menu like the one in the XWiki Admin panel but just to import in a subspace for an XWiki user with local admin right on this space

Is there a way to do it currently ? Could it be a feature request for you ? Maybe it’s “high effort” task I don’t know.

Regards,

Axel

Yes, see https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/ImportExport for more details about wiki page import/export.

Thanks for answering.

But this import page is in the admin panel and not accessible to thoses who are not in the XWikiAdminGroup right ?

We are looking for regular XWIki user to import xar in the spaces where they have editor/right admin.

Regards,

Axel

OK, this right constraint was not very clear in your first message. Then no, there is currently no way for a user without admin right to do a XAR import.

By the way you are only requesting this feature for import, but wouldn’t you also need to be able to do export without admin right (which is currently not possible either) ?

Both are a bit of work since the APIs which are used to do XAR import/export currently have hardcoded checks on admin right because it allows to do many dangerous things. But sure this feature make sense, just need to be very careful to not introduce a huge security vulnerability.

I think the XAR export is already available. Currently the export button suggest HTML, but if you go to the “Page and Children” and add the admin right for the space to user/groups XAR appear in addition of HTML, so it seems to already exist for the export

But maybe it would be nice to have XAR also for editor because we don’t give admin right it’s a bit too much.

The equivalent for import would be nice so ( for editor/admin ) if you can add it to the backlog, nothing urgent it’s just one of or feature request asked by users.

Without admin space right
Screenshot 2021-07-29 at 12.42.17
Screenshot 2021-07-29 at 12.40.41

With admin space right
Screenshot 2021-07-29 at 12.47.45
Screenshot 2021-07-29 at 12.42.55

I’m not talking about what you have in the UI but what right you need to have and as you pointed out you need admin right to do an export, even an export of a single page.

So should I understand that what you are asking for is not at all to do import without admin right but only to have an import button in the same location than the export one ? One problem is what do we do if the provided XAR contains a completely different page that the location where you called import or several pages ?

In any case the best is to create a NEW FEATURE issue on https://jira.xwiki.org and give idea if how you feel it should look like and behave. Of course, if you feel like working on it, it’s even better, and we could probably give you some pointers on how to implement what you want. It’s even doable as a contrib extension since those can inject new buttons in the menu where “Export” is located.