use of com.liferay.portal.model.Group in project liferay-ide by liferay.
the class WebServerServlet method sendGroups.
protected void sendGroups(HttpServletResponse response, User user, String path) throws Exception {
if (!PropsValues.WEB_SERVER_SERVLET_DIRECTORY_INDEXING_ENABLED) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
List<WebServerEntry> webServerEntries = new ArrayList<WebServerEntry>();
List<Group> groups = WebDAVUtil.getGroups(user);
for (Group group : groups) {
String name = HttpUtil.fixPath(group.getFriendlyURL());
WebServerEntry webServerEntry = new WebServerEntry(path, name + StringPool.SLASH, null, null, group.getDescription(), 0);
webServerEntries.add(webServerEntry);
}
sendHTML(response, path, webServerEntries);
}
use of com.liferay.portal.model.Group in project liferay-ide by liferay.
the class UserLocalServiceImpl method unsetOrganizationUsers.
/**
* Removes the users from the organization.
*
* @param organizationId the primary key of the organization
* @param userIds the primary keys of the users
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public void unsetOrganizationUsers(long organizationId, final long[] userIds) throws PortalException, SystemException {
Organization organization = organizationPersistence.findByPrimaryKey(organizationId);
final Group group = organization.getGroup();
userGroupRoleLocalService.deleteUserGroupRoles(userIds, group.getGroupId());
organizationPersistence.removeUsers(organizationId, userIds);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(userIds);
PermissionCacheUtil.clearCache();
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws Exception {
Message message = new Message();
message.put("groupId", group.getGroupId());
message.put("userIds", userIds);
MessageBusUtil.sendMessage(DestinationNames.SUBSCRIPTION_CLEAN_UP, message);
return null;
}
};
TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}
use of com.liferay.portal.model.Group in project liferay-ide by liferay.
the class UserLocalServiceImpl method deleteUser.
/**
* Deletes the user.
*
* @param user the user
* @return the deleted user
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public User deleteUser(User user) throws PortalException, SystemException {
if (!PropsValues.USERS_DELETE) {
throw new RequiredUserException();
}
// Browser tracker
browserTrackerLocalService.deleteUserBrowserTracker(user.getUserId());
// Group
Group group = null;
if (!user.isDefaultUser()) {
group = user.getGroup();
}
if (group != null) {
groupLocalService.deleteGroup(group);
}
try {
imageLocalService.deleteImage(user.getPortraitId());
} catch (NoSuchImageException nsie) {
if (_log.isWarnEnabled()) {
_log.warn("Unable to delete image " + user.getPortraitId());
}
}
// Password policy relation
passwordPolicyRelLocalService.deletePasswordPolicyRel(User.class.getName(), user.getUserId());
// Old passwords
passwordTrackerLocalService.deletePasswordTrackers(user.getUserId());
// Subscriptions
subscriptionLocalService.deleteSubscriptions(user.getUserId());
// External user ids
userIdMapperLocalService.deleteUserIdMappers(user.getUserId());
// Announcements
announcementsDeliveryLocalService.deleteDeliveries(user.getUserId());
// Asset
assetEntryLocalService.deleteEntry(User.class.getName(), user.getUserId());
// Blogs
blogsStatsUserLocalService.deleteStatsUserByUserId(user.getUserId());
// Document library
dlFileRankLocalService.deleteFileRanksByUserId(user.getUserId());
// Expando
expandoRowLocalService.deleteRows(user.getUserId());
// Message boards
mbBanLocalService.deleteBansByBanUserId(user.getUserId());
mbStatsUserLocalService.deleteStatsUsersByUserId(user.getUserId());
mbThreadFlagLocalService.deleteThreadFlagsByUserId(user.getUserId());
// Membership requests
membershipRequestLocalService.deleteMembershipRequestsByUserId(user.getUserId());
// Shopping cart
shoppingCartLocalService.deleteUserCarts(user.getUserId());
// Social
socialActivityLocalService.deleteUserActivities(user.getUserId());
socialRequestLocalService.deleteReceiverUserRequests(user.getUserId());
socialRequestLocalService.deleteUserRequests(user.getUserId());
// Mail
mailService.deleteUser(user.getCompanyId(), user.getUserId());
// Contact
Contact contact = contactLocalService.fetchContact(user.getContactId());
if (contact != null) {
contactLocalService.deleteContact(contact);
}
// Group roles
userGroupRoleLocalService.deleteUserGroupRolesByUserId(user.getUserId());
// Resources
resourceLocalService.deleteResource(user.getCompanyId(), User.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, user.getUserId());
// User
userPersistence.remove(user);
// Permission cache
PermissionCacheUtil.clearCache();
// Workflow
workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(user.getCompanyId(), 0, User.class.getName(), user.getUserId());
return user;
}
use of com.liferay.portal.model.Group in project liferay-ide by liferay.
the class UserLocalServiceImpl method sendEmailAddressVerification.
/**
* Sends an email address verification to the user.
*
* @param user the verification email recipient
* @param emailAddress the recipient's email address
* @param serviceContext the service context to be applied. Must set the
* portal URL, main path, primary key of the layout, remote address,
* remote host, and agent for the user.
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public void sendEmailAddressVerification(User user, String emailAddress, ServiceContext serviceContext) throws PortalException, SystemException {
if (user.isEmailAddressVerified() && StringUtil.equalsIgnoreCase(emailAddress, user.getEmailAddress())) {
return;
}
Ticket ticket = ticketLocalService.addTicket(user.getCompanyId(), User.class.getName(), user.getUserId(), TicketConstants.TYPE_EMAIL_ADDRESS, emailAddress, null, serviceContext);
String verifyEmailAddressURL = serviceContext.getPortalURL() + serviceContext.getPathMain() + "/portal/verify_email_address?ticketKey=" + ticket.getKey();
long plid = serviceContext.getPlid();
if (plid > 0) {
Layout layout = layoutLocalService.fetchLayout(plid);
if (layout != null) {
Group group = layout.getGroup();
if (!layout.isPrivateLayout() && !group.isUser()) {
verifyEmailAddressURL += "&p_l_id=" + serviceContext.getPlid();
}
}
}
String fromName = PrefsPropsUtil.getString(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_NAME);
String fromAddress = PrefsPropsUtil.getString(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);
String toName = user.getFullName();
String toAddress = emailAddress;
String subject = PrefsPropsUtil.getContent(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_VERIFICATION_SUBJECT);
String body = PrefsPropsUtil.getContent(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_VERIFICATION_BODY);
SubscriptionSender subscriptionSender = new SubscriptionSender();
subscriptionSender.setBody(body);
subscriptionSender.setCompanyId(user.getCompanyId());
subscriptionSender.setContextAttributes("[$EMAIL_VERIFICATION_CODE$]", ticket.getKey(), "[$EMAIL_VERIFICATION_URL$]", verifyEmailAddressURL, "[$REMOTE_ADDRESS$]", serviceContext.getRemoteAddr(), "[$REMOTE_HOST$]", serviceContext.getRemoteHost(), "[$USER_ID$]", user.getUserId(), "[$USER_SCREENNAME$]", user.getScreenName());
subscriptionSender.setFrom(fromAddress, fromName);
subscriptionSender.setHtmlFormat(true);
subscriptionSender.setMailId("user", user.getUserId(), System.currentTimeMillis(), PwdGenerator.getPassword());
subscriptionSender.setServiceContext(serviceContext);
subscriptionSender.setSubject(subject);
subscriptionSender.setUserId(user.getUserId());
subscriptionSender.addRuntimeSubscribers(toAddress, toName);
subscriptionSender.flushNotificationsAsync();
}
use of com.liferay.portal.model.Group in project liferay-ide by liferay.
the class KBArticleServiceImpl method getGroupKBArticlesRSS.
@Override
public String getGroupKBArticlesRSS(int status, int rssDelta, String rssDisplayStyle, String rssFormat, ThemeDisplay themeDisplay) throws PortalException, SystemException {
Group group = themeDisplay.getScopeGroup();
String descriptiveName = HtmlUtil.escape(group.getDescriptiveName(themeDisplay.getLocale()));
String name = descriptiveName;
String description = descriptiveName;
String feedURL = PortalUtil.getLayoutFullURL(themeDisplay);
List<KBArticle> kbArticles = getGroupKBArticles(group.getGroupId(), status, 0, rssDelta, new KBArticleModifiedDateComparator());
return exportToRSS(rssDisplayStyle, rssFormat, name, description, feedURL, kbArticles, themeDisplay);
}
Aggregations