/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsSecurityException(container, cause); } }
/** * Sets the password of this user.<p> * * @param value the password to set */ public void setPassword(String value) { try { OpenCms.getPasswordHandler().validatePassword(value); } catch (CmsSecurityException e) { throw new CmsIllegalArgumentException(e.getMessageContainer()); } m_password = value; }
/** * Helper method for reading the default file of a folder.<p> * * If the resource given already is a file, it will be returned, otherwise * the default file (or null, if none exists) of the folder will be returned. * * @param res the resource whose default file to read * @return the default file */ protected CmsResource getDefaultFileOrSelf(CmsResource res) { CmsResource defaultfile = null; if (res.isFolder()) { try { defaultfile = m_cms.readDefaultFile("" + res.getStructureId()); } catch (CmsSecurityException e) { LOG.error(e.getLocalizedMessage(), e); return null; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return null; } return defaultfile; } return res; }
/** * @see org.opencms.gwt.shared.rpc.I_CmsCoreService#changePassword(java.lang.String, java.lang.String, java.lang.String) */ public String changePassword(String oldPassword, String newPassword, String newPasswordConfirm) throws CmsRpcException { CmsObject cms = getCmsObject(); CmsPasswordInfo passwordBean = new CmsPasswordInfo(cms); Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); try { passwordBean.setCurrentPwd(oldPassword); passwordBean.setNewPwd(newPassword); passwordBean.setConfirmation(newPasswordConfirm); passwordBean.applyChanges(); return null; } catch (CmsSecurityException e) { LOG.error(e.getLocalizedMessage(), e); return e.getMessageContainer().key(wpLocale); } catch (CmsIllegalArgumentException e) { LOG.warn(e.getLocalizedMessage(), e); return e.getMessageContainer().key(wpLocale); } catch (Exception e) { error(e); return null; // will never be executed } }
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsSecurityException(container, cause); } }
/** * Sets the password of this user.<p> * * @param value the password to set */ public void setPassword(String value) { try { OpenCms.getPasswordHandler().validatePassword(value); } catch (CmsSecurityException e) { throw new CmsIllegalArgumentException(e.getMessageContainer()); } m_password = value; }
throw e; } catch (CmsSecurityException e) { LOG.warn(e.getLocalizedMessage(), e); throw e; } catch (CmsPdfLink.CmsPdfLinkParseException e) {
/** * @see org.opencms.security.I_CmsPasswordHandler#validatePassword(java.lang.String) */ public void validatePassword(String password) throws CmsSecurityException { if ((password == null) || (password.length() < PASSWORD_MIN_LENGTH)) { throw new CmsSecurityException( Messages.get().container(Messages.ERR_PASSWORD_TOO_SHORT_1, new Integer(PASSWORD_MIN_LENGTH))); } } }
/** * Checks the security level of the given password.<p> * * @param password the password */ void checkSecurity(String password) { I_CmsPasswordHandler handler = OpenCms.getPasswordHandler(); try { handler.validatePassword(password); if (handler instanceof I_CmsPasswordSecurityEvaluator) { SecurityLevel level = ((I_CmsPasswordSecurityEvaluator)handler).evaluatePasswordSecurity(password); m_form.setErrorPassword1(null, OpenCmsTheme.SECURITY + "-" + level.name()); } else { m_form.setErrorPassword1(null, OpenCmsTheme.SECURITY_STRONG); } } catch (CmsSecurityException e) { m_form.setErrorPassword1(new UserError(e.getLocalizedMessage(m_locale)), OpenCmsTheme.SECURITY_INVALID); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_form.getPassword2())) { showPasswordMatchError(!password.equals(m_form.getPassword2())); } }
/** * @see org.opencms.security.I_CmsPasswordHandler#validatePassword(java.lang.String) */ public void validatePassword(String password) throws CmsSecurityException { if ((password == null) || (password.length() < PASSWORD_MIN_LENGTH)) { throw new CmsSecurityException(Messages.get().container( Messages.ERR_PASSWORD_TOO_SHORT_1, new Integer(PASSWORD_MIN_LENGTH))); } } }
/** * Validates (translates) the given path and checks if it is filtered out.<p> * * @param path the path to validate * * @return the validated path * * @throws CmsSecurityException if the path is filtered out */ private String validatePath(String path) throws CmsSecurityException { // Problems with spaces in new folders (default: "Neuer Ordner") // Solution: translate this to a correct name. String ret = m_cms.getRequestContext().getFileTranslator().translateResource(path); // add site root only works correct if system folder ends with a slash if (CmsResource.VFS_FOLDER_SYSTEM.equals(ret)) { ret = ret.concat("/"); } // filter path if (isFiltered(ret)) { throw new CmsSecurityException(Messages.get().container(Messages.ERR_ITEM_FILTERED_1, path)); } return ret; } }
/** * Validates (translates) the given path and checks if it is filtered out.<p> * * @param path the path to validate * * @return the validated path * * @throws CmsSecurityException if the path is filtered out */ private String validatePath(String path) throws CmsSecurityException { // Problems with spaces in new folders (default: "Neuer Ordner") // Solution: translate this to a correct name. String ret = m_cms.getRequestContext().getFileTranslator().translateResource(path); // add site root only works correct if system folder ends with a slash if (CmsResource.VFS_FOLDER_SYSTEM.equals(ret)) { ret = ret.concat("/"); } // filter path if (isFiltered(ret)) { throw new CmsSecurityException(Messages.get().container(Messages.ERR_ITEM_FILTERED_1, path)); } return ret; } }
new CmsSecurityException( Messages.get().container( Messages.ERR_DIRECT_PUBLISH_NO_PERMISSIONS_1,
permissionIssues.addException(new CmsSecurityException(Messages.get().container( Messages.ERR_DIRECT_PUBLISH_NO_PERMISSIONS_1, dbc.removeSiteRoot(res.getRootPath()))));
/** * Aborts the given publish job.<p> * * @param cms the cms context * @param publishJob the publish job to abort * @param removeJob indicates if the job will be removed or added to history * * @throws CmsException if there is some problem during unlocking the resources * @throws CmsSecurityException if the current user has not enough permissions * @throws CmsPublishException if the publish job can not been aborted */ public void abortPublishJob(CmsObject cms, CmsPublishJobEnqueued publishJob, boolean removeJob) throws CmsException, CmsSecurityException, CmsPublishException { if (!OpenCms.getRoleManager().hasRole(cms, CmsRole.PROJECT_MANAGER) && !cms.getRequestContext().currentUser().getId().equals(publishJob.getUserId())) { // Can only be executed by somebody with the role CmsRole#PROJECT_MANAGER or the owner of the job throw new CmsSecurityException(Messages.get().container( Messages.ERR_PUBLISH_ENGINE_ABORT_DENIED_1, cms.getRequestContext().currentUser().getName())); } m_publishEngine.abortPublishJob(cms.getRequestContext().currentUser().getId(), publishJob, removeJob); }
throw new CmsSecurityException(Messages.get().container(Messages.ERR_DELETE_ROLE_GROUP_1, name));
/** * Aborts the given publish job.<p> * * @param cms the cms context * @param publishJob the publish job to abort * @param removeJob indicates if the job will be removed or added to history * * @throws CmsException if there is some problem during unlocking the resources * @throws CmsSecurityException if the current user has not enough permissions * @throws CmsPublishException if the publish job can not been aborted */ public void abortPublishJob(CmsObject cms, CmsPublishJobEnqueued publishJob, boolean removeJob) throws CmsException, CmsSecurityException, CmsPublishException { if (!OpenCms.getRoleManager().hasRole(cms, CmsRole.PROJECT_MANAGER) && !cms.getRequestContext().getCurrentUser().getId().equals(publishJob.getUserId())) { // Can only be executed by somebody with the role CmsRole#PROJECT_MANAGER or the owner of the job throw new CmsSecurityException( Messages.get().container( Messages.ERR_PUBLISH_ENGINE_ABORT_DENIED_1, cms.getRequestContext().getCurrentUser().getName())); } m_publishEngine.abortPublishJob(cms.getRequestContext().getCurrentUser().getId(), publishJob, removeJob); }
throw new CmsSecurityException(Messages.get().container(Messages.ERR_DELETE_ROLE_GROUP_1, name));
throw new CmsSecurityException(org.opencms.security.Messages.get().container( org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1, user.getName())); throw new CmsSecurityException(Messages.get().container(Messages.ERR_USER_CANT_DELETE_ITSELF_USER_0));
throw new CmsSecurityException( org.opencms.security.Messages.get().container( org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1, throw new CmsSecurityException(Messages.get().container(Messages.ERR_USER_CANT_DELETE_ITSELF_USER_0));