-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
Describe the bug
Does not work configeration option "Use the main wiki configuration" when we use subwiki (selected in Wiki index)
Steps to reproduce
Steps to reproduce the problematic behavior:
- Go to "Wiki index" and select subwiki (not main)
- Configure OnlyOffice extention with option "Use the main wiki configuration"
- Go to page with attached document in subwiki
- Go to attachments tab
- Click "Edit" on attached document
- See error
Expected behavior
We shoud have ability toi edit selected document.
Actual behavior
OnlyOffice server shows error.
Environment (please complete the following information):
- OS: Windows, Linux
- Browser: chrome
- XWiki version: 16.10.10
- App version: 2.4.2
Additional context
Found bug in com.xwiki.onlyofficeconnector.internal.DefaultOnlyOfficeManager#getSecret()
Always used secret key from current wiki.
Somehing like code bellow needed:
private static final String ONLYOFFICE_SPACE = "XWikiOnlyOfficeCode";
private static final String ONLYOFFICE_DOCUMENT = "ConfigurationClass";
private String getSecret()
{
XWikiContext context = contextProvider.get();
try {
// Current wiki
DocumentReference configReference = new DocumentReference(context.getWikiId(),
ONLYOFFICE_SPACE, ONLYOFFICE_DOCUMENT);
DocumentReference configClassReference = configReference;
XWikiDocument document = context.getWiki().getDocument(configReference, context);
BaseObject baseObject = document.getXObject(configClassReference);
String global = baseObject.getStringValue("useGlobalConfig");
if (!"0".equals(global)) {
// Global wiki
configReference = new DocumentReference(context.getMainXWiki(),
ONLYOFFICE_SPACE, ONLYOFFICE_DOCUMENT);
configClassReference = configReference;
document = context.getWiki().getDocument(configReference, context);
baseObject = document.getXObject(configClassReference);
}
String secret = baseObject.getStringValue("serverSecret");
return secret;
} catch (XWikiException e) {
logger.warn("Failed to retrieve the secret for generating/verifying a JWT.");
return "";
}
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo