/** * Returns true if the provided request was done by a Workplace user.<p> * * @param req the request to check * * @return true if the provided request was done by a Workplace user */ public static boolean isWorkplaceUser(HttpServletRequest req) { HttpSession session = req.getSession(false); if (session != null) { // if a session is available, check for a workplace configuration CmsWorkplaceSettings workplaceSettings = (CmsWorkplaceSettings)session.getAttribute( CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS); return ((null != workplaceSettings) && !workplaceSettings.getUser().isGuestUser()); } // no session means no workplace use return false; }
/** * Builds a String with HTML code to display the users access rights for the current resource.<p> * * @return HTML String with the access rights of the current user */ public String buildCurrentPermissions() { StringBuffer result = new StringBuffer( dialogToggleStart( key(Messages.GUI_PERMISSION_USER_0), "userpermissions", getSettings().getUserSettings().getDialogExpandUserPermissions())); result.append(dialogWhiteBoxStart()); try { result.append(buildPermissionEntryForm( getSettings().getUser().getId(), buildPermissionsForCurrentUser(), false, false)); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } result.append(dialogWhiteBoxEnd()); result.append("</div>\n"); return result.toString(); }
/** * Fills the parameter values according to the settings of the current user.<p> * * This method is called once when first displaying the preferences dialog.<p> */ private void fillUserSettings() { m_userSettings = new CmsUserSettings(getSettings().getUser()); }
/** * Builds a String with HTML code to display the users access rights for the current resource.<p> * * @return HTML String with the access rights of the current user */ public String buildCurrentPermissions() { StringBuffer result = new StringBuffer(dialogToggleStart( key(Messages.GUI_PERMISSION_USER_0), "userpermissions", getSettings().getUserSettings().getDialogExpandUserPermissions())); result.append(dialogWhiteBoxStart()); try { result.append(buildPermissionEntryForm( getSettings().getUser().getId(), buildPermissionsForCurrentUser(), false, false)); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } result.append(dialogWhiteBoxEnd()); result.append("</div>\n"); return result.toString(); }
/** * Returns the name of the current user for initializing the explorer view.<p> * * @return the name of the user */ public String getUserName() { return getSettings().getUser().getName(); }
/** * Returns the name of the current user for initializing the explorer view.<p> * * @return the name of the user */ public String getUserName() { return getSettings().getUser().getName(); }
/** * Fills the parameter values according to the settings of the current user.<p> * * This method is called once when first displaying the preferences dialog.<p> */ private void fillUserSettings() { m_userSettings = new CmsUserSettings(getSettings().getUser()); }
CmsUser user = getSettings().getUser();
CmsUser user = getSettings().getUser();
key( org.opencms.workplace.Messages.GUI_LABEL_WPTITLE_1, new Object[] {getSettings().getUser().getFullName()})).append("\n"); html.append("\t\t</title>\n"); html.append("\t</head>\n");
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
key( org.opencms.workplace.Messages.GUI_LABEL_WPTITLE_1, new Object[] {getSettings().getUser().getFullName()})).append("\n"); html.append("\t\t</title>\n"); html.append("\t</head>\n");
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
/** * Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p> * * @param request the current http servlet request * @param resourceType the preferred editors resource type * @return the preferred editor preselection value or null, if none found */ private String computeEditorPreselection(HttpServletRequest request, String resourceType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_PREFERREDEDITOR_PREFIX + resourceType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.decode(preSelection); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getPreferredEditor(resourceType); } }
/** * Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p> * * @param request the current http servlet request * @param galleryType the preferred gallery type * @return the preferred editor preselection value or null, if none found */ private String computeStartGalleryPreselection(HttpServletRequest request, String galleryType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_STARTGALLERY_PREFIX + galleryType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.decode(preSelection); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getStartGallery(galleryType); } }
/** * Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p> * * @param request the current http servlet request * @param resourceType the preferred editors resource type * @return the preferred editor preselection value or null, if none found */ private String computeEditorPreselection(HttpServletRequest request, String resourceType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_PREFERREDEDITOR_PREFIX + resourceType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.escapeSql(CmsEncoder.escapeXml(CmsEncoder.decode(preSelection))); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getPreferredEditor(resourceType); } }
/** * Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p> * * @param request the current http servlet request * @param resourceType the preferred editors resource type * @return the preferred editor preselection value or null, if none found */ private String computeStartGalleryPreselection(HttpServletRequest request, String galleryType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_STARTGALLERY_PREFIX + galleryType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.escapeSql(CmsEncoder.escapeXml(CmsEncoder.decode(preSelection))); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getStartGallery(galleryType); } }
String userName = getSettings().getUser().getName();
String userName = getSettings().getUser().getName();