Getting document title when you don't have permission
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 06:00 AM
Hi people :) I need to take the title of a document using java code even when the user doesn't have permission to see it.Can someone tell me if this is possible?
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 08:19 AM
Use a privileged session:
DocumentRef ref = doc.getRef();
String title = CoreInstance.doPrivileged(doc.getCoreSession(),
(CoreSession privilegedSession) -> (String) privilegedSession.getDocument(ref).getPropertyValue("dc:title")
);
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 11:21 AM
It's equivalent but UnrestrictedSessionRunner is more verbose.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 11:21 AM
Thank you Florent,but i found another way using UnrestrictedSessionRunner.I think this is better because i have to iterate through the parents of a document too.
