/** * Checks if a user is required to change his password now.<p> * * @param cms the current CMS context * @param user the user to check * * @return true if the user should be asked to change his password */ public boolean requiresPasswordChange(CmsObject cms, CmsUser user) { if (user.isManaged() || user.isWebuser() || OpenCms.getDefaultUsers().isDefaultUser(user.getName()) || OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN)) { return false; } String lastPasswordChangeStr = (String)user.getAdditionalInfo().get( CmsUserSettings.ADDITIONAL_INFO_LAST_PASSWORD_CHANGE); if (lastPasswordChangeStr == null) { return false; } long lastPasswordChange = Long.parseLong(lastPasswordChangeStr); if ((System.currentTimeMillis() - lastPasswordChange) > getPasswordChangeInterval()) { return true; } return false; }
/** * Checks whether a user account can be locked because of inactivity. * * @param cms the CMS context * @param user the user to check * @return true if the user may be locked after being inactive for too long */ public boolean canLockBecauseOfInactivity(CmsObject cms, CmsUser user) { return !user.isManaged() && !user.isWebuser() && !OpenCms.getDefaultUsers().isDefaultUser(user.getName()) && !OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN); }
/** * Checks if a user is required to change his password now.<p> * * @param cms the current CMS context * @param user the user to check * * @return true if the user should be asked to change his password */ public boolean requiresUserDataCheck(CmsObject cms, CmsUser user) { if (user.isManaged() || user.isWebuser() || OpenCms.getDefaultUsers().isDefaultUser(user.getName()) || OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN)) { return false; } String lastCheckStr = (String)user.getAdditionalInfo().get( CmsUserSettings.ADDITIONAL_INFO_LAST_USER_DATA_CHECK); if (lastCheckStr == null) { return !CmsStringUtil.isEmptyOrWhitespaceOnly(getUserDataCheckIntervalStr()); } long lastCheck = Long.parseLong(lastCheckStr); if ((System.currentTimeMillis() - lastCheck) > getUserDataCheckInterval()) { return true; } return false; }
throws CmsException, CmsSecurityException, CmsRoleViolationException { if (OpenCms.getDefaultUsers().isDefaultUser(user.getName())) { throw new CmsSecurityException(org.opencms.security.Messages.get().container( org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1,
throws CmsException, CmsSecurityException, CmsRoleViolationException { if (OpenCms.getDefaultUsers().isDefaultUser(user.getName())) { throw new CmsSecurityException( org.opencms.security.Messages.get().container(