This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the global group | |
Group globalGroup = GroupLocalServiceUtil.getCompanyGroup(companyId); | |
//get the guest group | |
Group guestGroup = GroupLocalServiceUtil.getGroup(companyId, GroupConstants.GUEST); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void createRegularRole(String roleName, Map<Locale, String> title, Map<Locale, String> description) { | |
long companyId = PortalUtil.getDefaultCompanyId(); | |
int type = RoleConstants.TYPE_REGULAR; | |
try { | |
Role newRole = RoleLocalServiceUtil.addRole(LiferayUtil.getDefaultUserId(companyId), companyId, roleName, | |
title, description, type); | |
LOGGER.info("Added new role with id [" + newRole.getRoleId() + "] and name [" + newRole.getName() + "]."); | |
} catch (Exception e) { | |
if (e instanceof DuplicateRoleException) { | |
LOGGER.debug("Role [" + roleName + "] already exists."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Folder getDLFolder(ThemeDisplay themeDisplay, String folderName) throws PortalException, SystemException { | |
long scopeGroupId = themeDisplay.getScopeGroupId(); | |
Folder folder = DLAppLocalServiceUtil.getFolder(scopeGroupId, 0, folderName); | |
if (folder != null) { | |
return folder; | |
} else { | |
throw new NoSuchFolderException(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private FileEntry addFileEntry(CommonsMultipartFile multipartFile, long userId, long repositoryId, | |
ServiceContext serviceContext, long folderId, String sourceFileName, String mimeType, String title, | |
String changeLog, String description) throws PortalException, SystemException { | |
FileEntry fileEntry = null; | |
try { | |
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, sourceFileName, mimeType, | |
title, description, changeLog, multipartFile.getBytes(), serviceContext); |