Merged V3.0 to HEAD

11943: Fix for ETHREEOH-879 & ETHREEOH-783: Multi-valued properties not allowed in Alfresco 3.0 (due to java.lang.UnsupportedOperationException)
   11944: Fix for ETHREEOH-865
   11947: Build fix for site service unit test failures.  This will be reviewed since it works round the issue rather than tackle why runAs is now failing.
   11952: ETHREEOH-845, ETHREEOH-871, ETHREEOH-853, ETHREEOH-839
   11953: ETHREEOH-483 Unable to upload files [with Flash 10 installed] Fixed to fit into yui 2.6.0
   11954: Added missing 'protocolOrder' configuration value.
   11956: Fix for ETHREEOH-895
   11957: Fix for ETHREEOH-891.
   11958: Readded generated source line for RemoteAPI project.
   11959: ETHREEOH-483 Unable to upload files [with Flash 10 installed] Missed to add this image
   11960: Removed JDK6 specific method.
   11962: Fixed missing setup of the share mapper class name when the <class> config tag is used. ALFCOM-2060.
   11964: fix for ETHREEOH-266 - restrict length of webapp to 150 chars.
   11965: Merged 2.2 to 3.0
      11926: Fox for ETHREEOH-725 User doesn't receive email to his box when rule 'Send an Email to specified users' is created 
   11966: ETHREEOH-872: Editing Email-notify-rules fails w/ ClassCastException
   11967: MT - test fixes (post runAs merge)
   11968: Changed Windows x64 NetBIOS warning message to be a debug message. ETHREEOH-897.
   11971: ETHREEOH-829 Case issue when inserting Document Share links into a discussion using richtext editor
   11973: Fix for ETHREEOH-890 - users with apostrophe in their login name can now login to Alfresco Explorer (and Share).

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12490 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-12-18 13:58:20 +00:00
parent 9cd516909e
commit 26d7b9669f
7 changed files with 72 additions and 62 deletions

View File

@@ -214,11 +214,11 @@ public class LoginBean implements Serializable
{ {
int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength(); int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength();
String pass = (String) value; String pass = (String)value;
if (pass.length() < minPasswordLength || pass.length() > 32) if (pass.length() < minPasswordLength || pass.length() > 256)
{ {
String err = MessageFormat.format(Application.getMessage(context, MSG_PASSWORD_LENGTH), String err = MessageFormat.format(Application.getMessage(context, MSG_PASSWORD_LENGTH),
new Object[]{minPasswordLength, 32}); new Object[]{minPasswordLength, 256});
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
} }
@@ -230,20 +230,19 @@ public class LoginBean implements Serializable
throws ValidatorException throws ValidatorException
{ {
int minUsernameLength = Application.getClientConfig(context).getMinUsernameLength(); int minUsernameLength = Application.getClientConfig(context).getMinUsernameLength();
String name = (String) value; String name = ((String)value).trim();
name = name.trim();
if (name.length() < minUsernameLength || name.length() > 256) if (name.length() < minUsernameLength || name.length() > 256)
{ {
String err = MessageFormat.format(Application.getMessage(context, MSG_USERNAME_LENGTH), String err = MessageFormat.format(Application.getMessage(context, MSG_USERNAME_LENGTH),
new Object[]{minUsernameLength, 256}); new Object[]{minUsernameLength, 256});
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1) if (name.indexOf('"') != -1)
{ {
String err = MessageFormat.format(Application.getMessage(context, MSG_USER_ERR), String err = MessageFormat.format(Application.getMessage(context, MSG_USER_ERR),
new Object[]{"', \", \\"}); new Object[]{"\""});
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
} }
@@ -426,12 +425,11 @@ public class LoginBean implements Serializable
private static final String MSG_ERROR_UNKNOWN_USER = "error_login_user"; private static final String MSG_ERROR_UNKNOWN_USER = "error_login_user";
private static final String MSG_ERROR_LOGIN_DISALLOWED = "error_login_disallowed"; private static final String MSG_ERROR_LOGIN_DISALLOWED = "error_login_disallowed";
private static final String MSG_ERROR_LOGIN_MAXUSERS = "error_login_maxusers"; private static final String MSG_ERROR_LOGIN_MAXUSERS = "error_login_maxusers";
private static final String MSG_USERNAME_CHARS = "login_err_username_chars";
private static final String MSG_USERNAME_LENGTH = "login_err_username_length"; public static final String MSG_USERNAME_LENGTH = "login_err_username_length";
private static final String MSG_PASSWORD_CHARS = "login_err_password_chars"; public static final String MSG_PASSWORD_LENGTH = "login_err_password_length";
private static final String MSG_PASSWORD_LENGTH = "login_err_password_length"; public static final String MSG_USER_ERR = "user_err_user_name";
private static final String MSG_USER_ERR = "user_err_user_name";
public static final String LOGIN_REDIRECT_KEY = "_alfRedirect"; public static final String LOGIN_REDIRECT_KEY = "_alfRedirect";
public static final String LOGIN_EXTERNAL_AUTH= "_alfExternalAuth"; public static final String LOGIN_EXTERNAL_AUTH= "_alfExternalAuth";

View File

@@ -95,7 +95,8 @@ public class MailHandler extends BaseActionHandler
} }
} }
public void prepareForEdit(Map<String, Serializable> actionProps, @SuppressWarnings("unchecked")
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps) Map<String, Serializable> repoProps)
{ {
// get hold of the current wizard so we can extract some data from it // get hold of the current wizard so we can extract some data from it
@@ -114,10 +115,26 @@ public class MailHandler extends BaseActionHandler
{ {
actionProps.put(PROP_TO, to); actionProps.put(PROP_TO, to);
} }
else else
{ {
List<String> recipients = (List<String>)repoProps.get(MailActionExecuter.PARAM_TO_MANY); Object recipObj = repoProps.get(MailActionExecuter.PARAM_TO_MANY);
if (recipients != null && recipients.size() != 0)
List<String> recipients = null;
if ( recipObj != null)
{
if ( recipObj instanceof String)
{
recipients = new ArrayList<String>();
recipients.add((String) recipObj);
}
else if ( recipObj instanceof List)
{
recipients = (List<String>) recipObj;
}
}
if (recipients != null && recipients.size() != 0)
{ {
// rebuild the list of RecipientWrapper objects from the stored action // rebuild the list of RecipientWrapper objects from the stored action
for (String authority : recipients) for (String authority : recipients)

View File

@@ -55,6 +55,7 @@ public class CreateGroupDialog extends BaseDialogBean
private static final String MSG_ROOT_GROUPS = "root_groups"; private static final String MSG_ROOT_GROUPS = "root_groups";
private static final String MSG_BUTTON_NEW_GROUP = "new_group"; private static final String MSG_BUTTON_NEW_GROUP = "new_group";
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Dialog implementation // Dialog implementation
@@ -112,6 +113,7 @@ public class CreateGroupDialog extends BaseDialogBean
return subtitle; return subtitle;
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean property getters and setters // Bean property getters and setters
@@ -135,13 +137,14 @@ public class CreateGroupDialog extends BaseDialogBean
*/ */
protected AuthorityService getAuthService() protected AuthorityService getAuthService()
{ {
//check for null in cluster environment
if (authService == null) if (authService == null)
{ {
authService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); authService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService();
} }
return authService; return authService;
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helpers // Helpers
@@ -149,10 +152,10 @@ public class CreateGroupDialog extends BaseDialogBean
{ {
String name = (String) value; String name = (String) value;
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1) if (name.indexOf('"') != -1 || name.indexOf('\\') != -1)
{ {
String err = MessageFormat.format(Application.getMessage(context, MSG_ERR_NAME), String err = MessageFormat.format(Application.getMessage(context, MSG_ERR_NAME),
new Object[] { "', \", \\" }); new Object[] { "\", \\" });
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
} }

View File

@@ -109,6 +109,14 @@ public class Node implements Serializable
for (QName qname: props.keySet()) for (QName qname: props.keySet())
{ {
Serializable propValue = props.get(qname); Serializable propValue = props.get(qname);
// Lists returned from the node service could be unmodifiable,
// therefore create copies for modification purposes
if (propValue instanceof List)
{
propValue = new ArrayList((List)propValue);
}
this.properties.put(qname.toString(), propValue); this.properties.put(qname.toString(), propValue);
} }

View File

@@ -54,6 +54,7 @@ import org.alfresco.util.Pair;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.LoginBean;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.spaces.CreateSpaceWizard; import org.alfresco.web.bean.spaces.CreateSpaceWizard;
import org.alfresco.web.bean.wizard.BaseWizardBean; import org.alfresco.web.bean.wizard.BaseWizardBean;
@@ -113,13 +114,13 @@ public class CreateUserWizard extends BaseWizardBean
/** ContentUsageService bean reference */ /** ContentUsageService bean reference */
transient private ContentUsageService contentUsageService; transient private ContentUsageService contentUsageService;
/** ref to the company home space folder */ /** ref to the company home space folder */
private NodeRef companyHomeSpaceRef = null; private NodeRef companyHomeSpaceRef = null;
/** ref to the default home location */ /** ref to the default home location */
private NodeRef defaultHomeSpaceRef; private NodeRef defaultHomeSpaceRef;
/** /**
* @param authenticationService The AuthenticationService to set. * @param authenticationService The AuthenticationService to set.
*/ */
@@ -128,13 +129,11 @@ public class CreateUserWizard extends BaseWizardBean
this.authenticationService = authenticationService; this.authenticationService = authenticationService;
} }
/** /**
* @return authenticationService * @return authenticationService
*/ */
private AuthenticationService getAuthenticationService() private AuthenticationService getAuthenticationService()
{ {
//check for null for cluster environment
if (authenticationService == null) if (authenticationService == null)
{ {
authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService(); authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService();
@@ -142,8 +141,6 @@ public class CreateUserWizard extends BaseWizardBean
return authenticationService; return authenticationService;
} }
/** /**
* @param personService The person service. * @param personService The person service.
*/ */
@@ -152,13 +149,11 @@ public class CreateUserWizard extends BaseWizardBean
this.personService = personService; this.personService = personService;
} }
/** /**
* @return personService * @return personService
*/ */
private PersonService getPersonService() private PersonService getPersonService()
{ {
//check for null for cluster environment
if (personService == null) if (personService == null)
{ {
personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService();
@@ -166,7 +161,6 @@ public class CreateUserWizard extends BaseWizardBean
return personService; return personService;
} }
/** /**
* @param tenantService The tenantService to set. * @param tenantService The tenantService to set.
*/ */
@@ -180,7 +174,6 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
private TenantService getTenantService() private TenantService getTenantService()
{ {
//check for null for cluster environment
if(tenantService == null) if(tenantService == null)
{ {
tenantService = (TenantService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "tenantService"); tenantService = (TenantService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "tenantService");
@@ -201,7 +194,6 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
private PermissionService getPermissionService() private PermissionService getPermissionService()
{ {
//check for null for cluster environment
if (permissionService == null) if (permissionService == null)
{ {
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
@@ -222,7 +214,6 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
private OwnableService getOwnableService() private OwnableService getOwnableService()
{ {
//check for null for cluster environment
if (ownableService == null) if (ownableService == null)
{ {
ownableService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getOwnableService(); ownableService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getOwnableService();
@@ -243,7 +234,6 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
private ContentUsageService getContentUsageService() private ContentUsageService getContentUsageService()
{ {
//check for null for cluster environment
if (contentUsageService == null) if (contentUsageService == null)
{ {
contentUsageService = (ContentUsageService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "ContentUsageService"); contentUsageService = (ContentUsageService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "ContentUsageService");
@@ -255,9 +245,9 @@ public class CreateUserWizard extends BaseWizardBean
* Initialises the wizard * Initialises the wizard
*/ */
@Override @Override
public void init(Map<String, String> arg0) public void init(Map<String, String> params)
{ {
super.init(arg0); super.init(params);
// reset all variables // reset all variables
this.firstName = ""; this.firstName = "";
@@ -606,21 +596,15 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
public void validatePassword(FacesContext context, UIComponent component, Object value) throws ValidatorException public void validatePassword(FacesContext context, UIComponent component, Object value) throws ValidatorException
{ {
String pass = (String) value; int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength();
if (pass.length() < 5 || pass.length() > 12)
String pass = (String)value;
if (pass.length() < minPasswordLength || pass.length() > 256)
{ {
String err = "Password must be between 5 and 12 characters in length."; String err = MessageFormat.format(Application.getMessage(context, LoginBean.MSG_PASSWORD_LENGTH),
new Object[]{minPasswordLength, 256});
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
for (int i = 0; i < pass.length(); i++)
{
if (Character.isLetterOrDigit(pass.charAt(i)) == false)
{
String err = "Password can only contain characters or digits.";
throw new ValidatorException(new FacesMessage(err));
}
}
} }
/** /**
@@ -628,20 +612,20 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
public void validateUsername(FacesContext context, UIComponent component, Object value) throws ValidatorException public void validateUsername(FacesContext context, UIComponent component, Object value) throws ValidatorException
{ {
String pass = (String) value; int minUsernameLength = Application.getClientConfig(context).getMinUsernameLength();
if (pass.length() < 5 || pass.length() > 12)
String name = ((String)value).trim();
if (name.length() < minUsernameLength || name.length() > 256)
{ {
String err = "Username must be between 5 and 12 characters in length."; String err = MessageFormat.format(Application.getMessage(context, LoginBean.MSG_USERNAME_LENGTH),
new Object[]{minUsernameLength, 256});
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));
} }
if (name.indexOf('"') != -1 || name.indexOf('\\') != -1)
for (int i = 0; i < pass.length(); i++)
{ {
if (Character.isLetterOrDigit(pass.charAt(i)) == false) String err = MessageFormat.format(Application.getMessage(context, LoginBean.MSG_USER_ERR),
{ new Object[]{"\", \\"});
String err = "Username can only contain characters or digits."; throw new ValidatorException(new FacesMessage(err));
throw new ValidatorException(new FacesMessage(err));
}
} }
} }

View File

@@ -77,7 +77,7 @@ onkeyup="javascript:checkButtonState();" /><f:verbatim>
<td><nobr></f:verbatim><h:outputText value="#{msg.export_from}:" rendered="#{NavigationBean.currentUser.admin == true}"/><f:verbatim></nobr></td> <td><nobr></f:verbatim><h:outputText value="#{msg.export_from}:" rendered="#{NavigationBean.currentUser.admin == true}"/><f:verbatim></nobr></td>
<td> <td>
</f:verbatim><h:selectOneRadio value="#{DialogManager.bean.mode}" layout="pageDirection" rendered="#{NavigationBean.currentUser.admin == true}"> </f:verbatim><h:selectOneRadio value="#{DialogManager.bean.mode}" layout="pageDirection" rendered="#{NavigationBean.currentUser.admin == true}">
<f:selectItem itemValue="all" itemLabel="#{msg.all_spaces_root}" itemDisabled="true" /> <%--<f:selectItem itemValue="all" itemLabel="#{msg.all_spaces_root}" itemDisabled="true" />--%>
<f:selectItem itemValue="current" itemLabel="#{msg.current_space}" /> <f:selectItem itemValue="current" itemLabel="#{msg.current_space}" />
</h:selectOneRadio><f:verbatim> </h:selectOneRadio><f:verbatim>
</td> </td>

View File

@@ -92,7 +92,7 @@
</td> </td>
<td width="85%"> <td width="85%">
</f:verbatim> </f:verbatim>
<h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="1024" <h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="150"
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" /> onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim> <f:verbatim>
</td> </td>
@@ -106,7 +106,7 @@
</td> </td>
<td> <td>
</f:verbatim> </f:verbatim>
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" /> <h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="500" />
<f:verbatim> <f:verbatim>
</td> </td>
</tr> </tr>