on 07-09-2007 1:30 PM
Hi all,
I have a pickle of a problem, which I am trying to solve.
The portal we need to implement this on, has Companies implemented, which means something changes in the security model - and makes an authenticated user unreachable for me.
The usual way of getting the user:
com.sap.security.api.IUser sapUser = com.sap.security.api.UMFactory.getAuthenticator().getLoggedInUser();
IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
... means that if I subsequently check for ep5User.isAuthenticated(), it always returns false (this is a webdynpro application, so there's no "request" object available to me).
What do I do next? I need the authenticated user, so I can connect to KM, and overwrite files - anonymous write/delete permissions is not allowed on this system.
Points will be awarded for any help
I have narrowed the problem further down...
This code returns an authenticated user, through the WDClientUser - factory:
private IUser getResourceUser() throws UserManagementException {
IWDClientUser wdClientUser;
com.sap.security.api.IUser sapUser;
com.sapportals.portal.security.usermanagement.IUser ep5User = null;
try {
wdClientUser = WDClientUser.getCurrentUser();
sapUser = wdClientUser.getSAPUser();
ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportException(e.getClass().getName() + " - " + e.getLocalizedMessage(), true);
}
return ep5User;
}
... however, my root problem is still there.
I still can't overwrite any files though. Whenever I try to overwrite a file, by getting the IResource handle to it, and doing a .updateContent(IContent) - I get an error:
"com.sapportals.wcm.repository.IOErrorException - error writing content"
Can anyone help with what might be wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "com.sapportals.wcm.repository.IOErrorException - error writing content" error comes when I try to write to the default /documents - repository manager.
I have to write to a CM Repository manager, which is versioned.
When I do this, I get the following exception:
"class com.sapportals.wcm.repository.IOErrorException - length (0) does not match expected length 20" - when I try to write a file with length 20 bytes.
If I try to write 61722 bytes to the file, I get the error:
"class com.sapportals.wcm.repository.IOErrorException - length (0) does not match expected length 61722".
Hi Brik,
i had the same issue.
Here is the solution:
etrieve the HttpRequest using
public HttpServletRequest getHttpRequest() throws Exception {
// Get runtime context
Properties props = new Properties();
props.put("domain", "true");
Context initialContext = new InitialContext(props);
ApplicationWebServiceContext wsContext = (ApplicationWebServiceContext) initialContext
.lookup(" /wsContext/ApplicationWebServiceContext");
HttpServletRequest req = wsContext.getHttpServletRequest();
return req;
}
and get the authenticated user from the http request:
com.sap.security.api.IUser sapUser = com.sap.security.api.UMFactory.getAuthenticator().getLoggedInUser(getHttpRequest(), null);
IUser ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);
the com.sap.engine.interfaces.webservices.runtime.ApplicationWebServiceContext is located in the webservices_api.jar located in the folder j2ee\cluster\server0\bin\interfaces\webservices on your J2EE.
Maybe it helps you for the future.
Best regards
Jochen
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.