Skip to content

Instantly share code, notes, and snippets.

@kimakunc
Created May 28, 2013 09:34
Show Gist options
  • Save kimakunc/5661615 to your computer and use it in GitHub Desktop.
Save kimakunc/5661615 to your computer and use it in GitHub Desktop.
Set "view" and "update" permissions on Expando Column for the "Guest" role using Liferay API.
private static void setExpandoPermissions(long companyId, ExpandoColumn column) {
try {
Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
if (guestUserRole != null) {
// define actions
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
// set the permission
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), actionIds);
}
} catch (PortalException pe) {
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment