Fórum
Enable guest view permission by Programmatically
Kushagra Khanna, modificado 7 Anos atrás.
Enable guest view permission by Programmatically
Junior Member Postagens: 45 Data de Entrada: 28/12/14 Postagens Recentes
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 7 Anos atrás.
RE: Enable guest view permission by Programmatically
Junior Member Postagens: 64 Data de Entrada: 03/09/15 Postagens Recentes
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 7 Anos atrás.
RE: Enable guest view permission by Programmatically
Junior Member Postagens: 45 Data de Entrada: 28/12/14 Postagens Recentes
Hi Sayed
Thanks for your reply, its was really helpful.
Thanks for your reply, its was really helpful.