Merged V3.2 to HEAD

16681: Fixed ETHREEOH-2454 "It's possible to create a group with less than 3 symbols in JSF client, but it's impossible to find it in Share client"
      - Group name can now only be between 3-100 characters in webclient


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16901 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Erik Winlof
2009-10-14 10:05:53 +00:00
parent b5e044226c
commit e2fa0967aa
5 changed files with 49 additions and 5 deletions

View File

@@ -579,6 +579,7 @@ title_add_user_group=Add User to Group
add_user_group_description=Add an existing User to a Group add_user_group_description=Add an existing User to a Group
select_users=Select Users to add to this Group select_users=Select Users to add to this Group
selected_users=Selected Users selected_users=Selected Users
groups_err_group_name_length=Group ID must be between {0} and {1} characters in length.
groups_err_group_name=Group ID cannot contain the characters: {0} groups_err_group_name=Group ID cannot contain the characters: {0}
groups_err_exists=A group ID with the same name already exists, group identifiers must be unique. groups_err_exists=A group ID with the same name already exists, group identifiers must be unique.
Read=Read Read=Read

View File

@@ -89,6 +89,9 @@
<username-min-length>2</username-min-length> <username-min-length>2</username-min-length>
<password-min-length>3</password-min-length> <password-min-length>3</password-min-length>
<!-- minimum length for group name -->
<group-name-min-length>3</group-name-min-length>
<!-- Domain suffix appended to the CIFS URL host name --> <!-- Domain suffix appended to the CIFS URL host name -->
<!-- <!--
<cifs-url-suffix>.alfresco.org</cifs-url-suffix> <cifs-url-suffix>.alfresco.org</cifs-url-suffix>

View File

@@ -51,6 +51,7 @@ public class CreateGroupDialog extends BaseDialogBean
transient private AuthorityService authService; transient private AuthorityService authService;
private static final String MSG_ERR_EXISTS = "groups_err_exists"; private static final String MSG_ERR_EXISTS = "groups_err_exists";
private static final String MSG_GROUPNAME_LENGTH = "groups_err_group_name_length";
private static final String MSG_ERR_NAME = "groups_err_group_name"; private static final String MSG_ERR_NAME = "groups_err_group_name";
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";
@@ -154,8 +155,17 @@ public class CreateGroupDialog extends BaseDialogBean
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
{ {
String name = (String) value; int minGroupNameLength = Application.getClientConfig(context).getMinGroupNameLength();
String name = ((String)value).trim();
if (name.length() < minGroupNameLength || name.length() > 100)
{
String err = MessageFormat.format(Application.getMessage(context, MSG_GROUPNAME_LENGTH),
new Object[]{minGroupNameLength, 100});
throw new ValidatorException(new FacesMessage(err));
}
if (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),

View File

@@ -80,6 +80,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private List<QName> simpleSearchAdditionalAttributes = null; private List<QName> simpleSearchAdditionalAttributes = null;
private int minUsernameLength = 2; private int minUsernameLength = 2;
private int minPasswordLength = 3; private int minPasswordLength = 3;
private int minGroupNameLength = 3;
private String breadcrumbMode = BREADCRUMB_PATH; private String breadcrumbMode = BREADCRUMB_PATH;
private String cifsURLSuffix = null; private String cifsURLSuffix = null;
private boolean languageSelect = true; private boolean languageSelect = true;
@@ -276,7 +277,12 @@ public class ClientConfigElement extends ConfigElementAdapter
{ {
combinedElement.setMinPasswordLength(newElement.getMinPasswordLength()); combinedElement.setMinPasswordLength(newElement.getMinPasswordLength());
} }
if (newElement.getMinGroupNameLength() != combinedElement.getMinGroupNameLength())
{
combinedElement.setMinGroupNameLength(newElement.getMinGroupNameLength());
}
if (newElement.getBreadcrumbMode() != null && if (newElement.getBreadcrumbMode() != null &&
newElement.getBreadcrumbMode().equals(combinedElement.getBreadcrumbMode()) == false) newElement.getBreadcrumbMode().equals(combinedElement.getBreadcrumbMode()) == false)
{ {
@@ -728,7 +734,23 @@ public class ClientConfigElement extends ConfigElementAdapter
{ {
this.minPasswordLength = minPasswordLength; this.minPasswordLength = minPasswordLength;
} }
/**
* @return Returns the minimum length for a group name.
*/
public int getMinGroupNameLength()
{
return this.minGroupNameLength;
}
/**
* @param minGroupNameLength The minimum length of a group name
*/
/*package*/ void setMinGroupNameLength(int minGroupNameLength)
{
this.minGroupNameLength = minGroupNameLength;
}
/** /**
* Get the breadcrumb mode * Get the breadcrumb mode
* *

View File

@@ -64,6 +64,7 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_SIMPLESEARCHADDITIONALATTRSQNAME = "qname"; public static final String ELEMENT_SIMPLESEARCHADDITIONALATTRSQNAME = "qname";
public static final String ELEMENT_MINUSERNAMELENGTH = "username-min-length"; public static final String ELEMENT_MINUSERNAMELENGTH = "username-min-length";
public static final String ELEMENT_MINPASSWORDLENGTH = "password-min-length"; public static final String ELEMENT_MINPASSWORDLENGTH = "password-min-length";
public static final String ELEMENT_MINGROUPNAMELENGTH = "group-name-min-length";
public static final String ELEMENT_BREADCRUMB_MODE = "breadcrumb-mode"; public static final String ELEMENT_BREADCRUMB_MODE = "breadcrumb-mode";
public static final String ELEMENT_CIFSURLSUFFIX = "cifs-url-suffix"; public static final String ELEMENT_CIFSURLSUFFIX = "cifs-url-suffix";
public static final String ELEMENT_LANGUAGESELECT = "language-select"; public static final String ELEMENT_LANGUAGESELECT = "language-select";
@@ -261,7 +262,14 @@ public class ClientElementReader implements ConfigElementReader
{ {
configElement.setMinPasswordLength(Integer.parseInt(minPassword.getTextTrim())); configElement.setMinPasswordLength(Integer.parseInt(minPassword.getTextTrim()));
} }
// get the minimum length of group names
Element minGroupName = element.element(ELEMENT_MINGROUPNAMELENGTH);
if (minGroupName != null)
{
configElement.setMinGroupNameLength(Integer.parseInt(minGroupName.getTextTrim()));
}
// get the breadcrumb mode // get the breadcrumb mode
Element breadcrumbMode = element.element(ELEMENT_BREADCRUMB_MODE); Element breadcrumbMode = element.element(ELEMENT_BREADCRUMB_MODE);
if (breadcrumbMode != null) if (breadcrumbMode != null)