deepyaraj commented on a change in pull request #88:
URL: https://github.com/apache/qpid-broker-j/pull/88#discussion_r644690778
##########
File path:
broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
##########
@@ -205,17 +205,22 @@ public String getPath()
{
throw new IllegalConfigurationException(String.format("Group
provider '%s' is not activated. Cannot create a group.", getName()));
}
+ Set<String> availableGroups = _groupDatabase.getAllGroups();
+ if(!availableGroups.contains(groupName))
+ {
+ _groupDatabase.createGroup(groupName);
- _groupDatabase.createGroup(groupName);
-
- Map<String,Object> attrMap = new HashMap<String, Object>();
- UUID id = UUID.randomUUID();
- attrMap.put(ConfiguredObject.ID, id);
- attrMap.put(ConfiguredObject.NAME, groupName);
- GroupAdapter groupAdapter = new GroupAdapter(attrMap);
- groupAdapter.create();
- return Futures.immediateFuture((C) groupAdapter);
-
+ Map<String, Object> attrMap = new HashMap<String, Object>();
+ UUID id = UUID.randomUUID();
+ attrMap.put(ConfiguredObject.ID, id);
+ attrMap.put(ConfiguredObject.NAME, groupName);
+ GroupAdapter groupAdapter = new GroupAdapter(attrMap);
+ groupAdapter.create();
+ return Futures.immediateFuture((C) groupAdapter);
+ }
+ else{
Review comment:
Done!
##########
File path:
broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
##########
@@ -205,17 +205,22 @@ public String getPath()
{
throw new IllegalConfigurationException(String.format("Group
provider '%s' is not activated. Cannot create a group.", getName()));
}
+ Set<String> availableGroups = _groupDatabase.getAllGroups();
+ if(!availableGroups.contains(groupName))
Review comment:
Done!
##########
File path:
broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
##########
@@ -359,16 +364,21 @@ protected void onOpen()
if (childClass == GroupMember.class)
{
String memberName = (String) attributes.get(GroupMember.NAME);
-
- _groupDatabase.addUserToGroup(memberName, getName());
- UUID id = UUID.randomUUID();
- Map<String,Object> attrMap = new HashMap<String, Object>();
- attrMap.put(GroupMember.ID,id);
- attrMap.put(GroupMember.NAME, memberName);
- GroupMemberAdapter groupMemberAdapter = new
GroupMemberAdapter(attrMap);
- groupMemberAdapter.create();
- return Futures.immediateFuture((C) groupMemberAdapter);
-
+ Set<String> users = _groupDatabase.getUsersInGroup(getName());
+ if(!users.contains(memberName))
Review comment:
Done!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]