Foros de discusión

Fetching threads with view permission only

santhosh Venugopal, modificado hace 9 años.

Fetching threads with view permission only

New Member Mensajes: 2 Fecha de incorporación: 23/05/14 Mensajes recientes
I am working on requirement where I have to display latest discussion topics..
I have achieved the same like below..

List<MBThread> threadsList = MBThreadLocalServiceUtil.getGroupThreads(lPortletGroupId, 0, WorkflowConstants.STATUS_APPROVED, false, true, -1, -1);
for(MBThread thread : threadsList){
MBThread lTempThread = MBThreadLocalServiceUtil.getThread(thread.getThreadId());
MBMessage message = MBMessageServiceUtil.getMessage(lTempThread.getRootMessageId());//exception occurs here..
String subject = message.getSubject();
//Display topics..
}

However when certain threads are locked(for guest user), I get PrincipalException.

Permission check like below always returns false.
boolean hasPerm = permissionChecker.hasPermission(lPortletGroupId, MBThread.class.getName(),thread.getRootMessageId(), ActionKeys.VIEW);

However the same permission check with MBcategories works fine..I need to get threads with view permission only..Where am I going wrong?.Please help..
thumbnail
Shinn Lok, modificado hace 9 años.

RE: Fetching threads with view permission only

Junior Member Mensajes: 89 Fecha de incorporación: 14/01/11 Mensajes recientes
I think calling MBThreadServiceUtil.getGroupThreads instead of the LocalService gets what you want?