mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for AWC-613 - Groups UI now checks for duplicate existing group IDs when creating new/sub groups
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2968 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -413,6 +413,7 @@ 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=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.
|
||||||
|
|
||||||
# Invite Users Wizard messages
|
# Invite Users Wizard messages
|
||||||
invite_title=Invite Users Wizard
|
invite_title=Invite Users Wizard
|
||||||
|
@@ -68,6 +68,7 @@ public class GroupsBean implements IContextListener
|
|||||||
|
|
||||||
private static final String DEFAULT_OUTCOME = "finish";
|
private static final String DEFAULT_OUTCOME = "finish";
|
||||||
|
|
||||||
|
private static final String MSG_ERR_EXISTS = "groups_err_exists";
|
||||||
private static final String MSG_GROUPS = "root_groups";
|
private static final String MSG_GROUPS = "root_groups";
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(GroupsBean.class);
|
private static Logger logger = Logger.getLogger(GroupsBean.class);
|
||||||
@@ -648,15 +649,24 @@ public class GroupsBean implements IContextListener
|
|||||||
{
|
{
|
||||||
String outcome = DEFAULT_OUTCOME;
|
String outcome = DEFAULT_OUTCOME;
|
||||||
|
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
UserTransaction tx = null;
|
UserTransaction tx = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
|
||||||
tx = Repository.getUserTransaction(context);
|
tx = Repository.getUserTransaction(context);
|
||||||
tx.begin();
|
tx.begin();
|
||||||
|
|
||||||
// create new Group using Authentication Service
|
// create new Group using Authentication Service
|
||||||
|
String groupName = this.authService.getName(AuthorityType.GROUP, this.name);
|
||||||
|
if (this.authService.authorityExists(groupName) == false)
|
||||||
|
{
|
||||||
this.authService.createAuthority(AuthorityType.GROUP, getActionGroup(), this.name);
|
this.authService.createAuthority(AuthorityType.GROUP, getActionGroup(), this.name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
|
||||||
|
outcome = null;
|
||||||
|
}
|
||||||
|
|
||||||
// commit the transaction
|
// commit the transaction
|
||||||
tx.commit();
|
tx.commit();
|
||||||
@@ -666,7 +676,7 @@ public class GroupsBean implements IContextListener
|
|||||||
// rollback the transaction
|
// rollback the transaction
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
outcome = null;
|
outcome = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user