Foros de discusión
Enable guest view permission by Programmatically
Kushagra Khanna, modificado hace 7 años.
Enable guest view permission by Programmatically
Junior Member Mensajes: 45 Fecha de incorporación: 28/12/14 Mensajes recientes
Hi Community,
I have a one query that, how can I enable guest view permission programmatically on set of documents that had been already uploaded.
What approaches and implementation need to be followed to achieve this functionality.
Regards,
Kushagra
I have a one query that, how can I enable guest view permission programmatically on set of documents that had been already uploaded.
What approaches and implementation need to be followed to achieve this functionality.
Regards,
Kushagra
Syed Nasar, modificado hace 7 años.
RE: Enable guest view permission by Programmatically
Junior Member Mensajes: 64 Fecha de incorporación: 3/09/15 Mensajes recientes
Hi Kushagra,
Try this working example, Hope It helps.
Where fileEntry is object of document that you uploaded.
Try this working example, Hope It helps.
Role role = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "guest");
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
ResourcePermissionServiceUtil.setIndividualResourcePermissions(themeDisplay.getScopeGroupId(),
themeDisplay.getCompanyId(), FileEntry.class.getName(), String.valueOf(fileEntry.getPrimaryKey()),role.getRoleId(), new String[] { ActionKeys.VIEW });
Where fileEntry is object of document that you uploaded.
Kushagra Khanna, modificado hace 7 años.
RE: Enable guest view permission by Programmatically
Junior Member Mensajes: 45 Fecha de incorporación: 28/12/14 Mensajes recientes
Hi Sayed
Thanks for your reply, its was really helpful.
Thanks for your reply, its was really helpful.