mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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
163 lines
5.2 KiB
Java
163 lines
5.2 KiB
Java
/*
|
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
* As a special exception to the terms and conditions of version 2.0 of
|
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
|
* FLOSS exception. You should have recieved a copy of the text describing
|
|
* the FLOSS exception, and it is also available here:
|
|
* http://www.alfresco.com/legal/licensing"
|
|
*/
|
|
package org.alfresco.web.bean.groups;
|
|
|
|
import java.text.MessageFormat;
|
|
import java.util.Map;
|
|
|
|
import javax.faces.application.FacesMessage;
|
|
import javax.faces.component.UIComponent;
|
|
import javax.faces.context.FacesContext;
|
|
import javax.faces.validator.ValidatorException;
|
|
|
|
import org.alfresco.service.cmr.security.AuthorityService;
|
|
import org.alfresco.service.cmr.security.AuthorityType;
|
|
import org.alfresco.web.app.Application;
|
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
|
import org.alfresco.web.bean.repository.Repository;
|
|
import org.alfresco.web.ui.common.Utils;
|
|
|
|
public class CreateGroupDialog extends BaseDialogBean
|
|
{
|
|
private static final long serialVersionUID = -8074475974375860695L;
|
|
|
|
protected String parentGroup;
|
|
protected String parentGroupName;
|
|
protected String name;
|
|
|
|
/** The AuthorityService to be used by the bean */
|
|
transient private AuthorityService authService;
|
|
|
|
private static final String MSG_ERR_EXISTS = "groups_err_exists";
|
|
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_BUTTON_NEW_GROUP = "new_group";
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Dialog implementation
|
|
|
|
@Override
|
|
public void init(Map<String, String> parameters)
|
|
{
|
|
super.init(parameters);
|
|
|
|
// retrieve parameters
|
|
this.parentGroup = parameters.get(GroupsDialog.PARAM_GROUP);
|
|
this.parentGroupName = parameters.get(GroupsDialog.PARAM_GROUP_NAME);
|
|
|
|
// reset variables
|
|
this.name = null;
|
|
}
|
|
|
|
@Override
|
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
|
{
|
|
// create new Group using Authentication Service
|
|
String groupName = this.getAuthService().getName(AuthorityType.GROUP, this.name);
|
|
if (this.getAuthService().authorityExists(groupName) == false)
|
|
{
|
|
this.getAuthService().createAuthority(AuthorityType.GROUP, this.parentGroup, this.name);
|
|
}
|
|
else
|
|
{
|
|
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
|
|
outcome = null;
|
|
}
|
|
|
|
return outcome;
|
|
}
|
|
|
|
@Override
|
|
public String getFinishButtonLabel()
|
|
{
|
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_BUTTON_NEW_GROUP);
|
|
}
|
|
|
|
@Override
|
|
public String getContainerSubTitle()
|
|
{
|
|
String subtitle = null;
|
|
|
|
if (this.parentGroupName != null)
|
|
{
|
|
subtitle = this.parentGroupName;
|
|
}
|
|
else
|
|
{
|
|
subtitle = Application.getMessage(FacesContext.getCurrentInstance(), MSG_ROOT_GROUPS);
|
|
}
|
|
|
|
return subtitle;
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Bean property getters and setters
|
|
|
|
public String getName()
|
|
{
|
|
return this.name;
|
|
}
|
|
|
|
public void setName(String name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public void setAuthService(AuthorityService authService)
|
|
{
|
|
this.authService = authService;
|
|
}
|
|
|
|
/**
|
|
* @return the authService
|
|
*/
|
|
protected AuthorityService getAuthService()
|
|
{
|
|
if (authService == null)
|
|
{
|
|
authService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService();
|
|
}
|
|
return authService;
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Helpers
|
|
|
|
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
|
|
{
|
|
String name = (String) value;
|
|
|
|
if (name.indexOf('"') != -1 || name.indexOf('\\') != -1)
|
|
{
|
|
String err = MessageFormat.format(Application.getMessage(context, MSG_ERR_NAME),
|
|
new Object[] { "\", \\" });
|
|
throw new ValidatorException(new FacesMessage(err));
|
|
}
|
|
}
|
|
}
|