/**
  * Method to save the send settings.
  *
  * @param request The current request.
  * @param notificationSettings The settings to save.
  * @param result The result to bind errors and so on to.
  * @return The ModelAndView to use.
  */
 @RequestMapping(method = RequestMethod.POST)
 public ModelAndView saveSettings(
     HttpServletRequest request,
     @ModelAttribute("command") ClientProfileNotificationsForm notificationSettings,
     BindingResult result) {
   Map<ClientConfigurationPropertyConstant, String> settings =
       new HashMap<ClientConfigurationPropertyConstant, String>();
   settings.put(
       ClientProperty.NOTIFICATION_RENDER_ATTACHMENTLINKS,
       Boolean.toString(notificationSettings.isRenderAttachmentLinks()));
   settings.put(
       ClientProperty.NOTIFICATION_RENDER_PERMALINKS,
       Boolean.toString(notificationSettings.isRenderPermalinks()));
   settings.put(
       ClientProperty.INVITATION_RENDER_BLOG_PERMALINK,
       Boolean.toString(notificationSettings.isRenderBlogPermalinkInInvitation()));
   settings.put(
       ClientProperty.MAX_NUMBER_OF_MENTIONED_USERS,
       Integer.toString(notificationSettings.getMaxUsersToMention()));
   CommunoteRuntime.getInstance()
       .getConfigurationManager()
       .updateClientConfigurationProperties(settings);
   MessageHelper.saveMessageFromKey(request, "client.profile.notifications.success");
   return get();
 }
コード例 #2
0
 /**
  * Returns whether a user can delete his account.
  *
  * @return true if one of the user deletion modes (e.g. permanently disable) is enabled
  */
 public static boolean isUserDeletionAllowed() {
   ClientConfigurationProperties cp =
       CommunoteRuntime.getInstance().getConfigurationManager().getClientConfigurationProperties();
   return cp.getProperty(
           ClientProperty.DELETE_USER_BY_ANONYMIZE_ENABLED,
           ClientProperty.DEFAULT_DELETE_USER_BY_ANONYMIZE_ENABLED)
       || cp.getProperty(
           ClientProperty.DELETE_USER_BY_DISABLE_ENABLED,
           ClientProperty.DEFAULT_DELETE_USER_BY_DISABLE_ENABLED);
 }
 /**
  * Creates a human readable string for the attachment upload size limit.
  *
  * @return the human readable string of the max upload size
  */
 private String getHumanReadableUploadSizeLimit() {
   if (humanReadableUploadSizeLimit == null) {
     long fileUploadLimit =
         Long.parseLong(
             CommunoteRuntime.getInstance()
                 .getConfigurationManager()
                 .getApplicationConfigurationProperties()
                 .getProperty(ApplicationProperty.ATTACHMENT_MAX_UPLOAD_SIZE));
     humanReadableUploadSizeLimit = FileUtils.byteCountToDisplaySize(fileUploadLimit);
   }
   return humanReadableUploadSizeLimit;
 }