Skip to content
Permalink
Browse files
Implement user and group membership listening
  • Loading branch information
isururanawaka committed Sep 21, 2021
1 parent 7e78244 commit 345a7aafaa7a49ed4e428d820662556d7955e656
Showing 2 changed files with 8 additions and 6 deletions.
@@ -188,7 +188,7 @@ public void deleteGroup(String groupId, String clientId) {

public void deleteUserGroupMembership(String username, String tenantId, String groupId) {
String query = "MATCH (a:User)-[r:MEMBER_OF]->(b:Group) WHERE a.username = $username AND a.tenantId = $tenantId " +
"AND " + "b.groupId =$groupId AND b.tenantId =$tenantId Delete r";
"AND " + "b.groupId =$groupId AND b.tenantId =$tenantId DETACH DELETE r";
Map<String, Object> map = new HashMap<>();
map.put("username", username);
map.put("groupId", groupId);
@@ -26,8 +26,9 @@ public static void delegateEvents(Message message) {
case "DELETE_GROUP":
deleteGroup(message);
break;


case "REMOVE_USER_FROM_GROUP":
deleteGroupMembership(message);
break;
}
break;
case "SHARING_MANAGEMENT_SERVICE":
@@ -45,8 +46,8 @@ public static void delegateEvents(Message message) {
break;
default:
}
}catch (Exception ex) {
ex.printStackTrace();
} catch (Exception ex) {
LOGGER.error("Error occurred while decoding custos event ",ex);
}

}
@@ -92,7 +93,8 @@ private static void deleteGroupMembership(Message message) {
UserAndGroupHandler userAndGroupHandler = new UserAndGroupHandler();
String clientId = message.getClientId();
String groupId = message.getPropertiesMap().get("GROUP_ID");
userAndGroupHandler.deleteGroup(groupId, clientId);
String userId = message.getPropertiesMap().get("USER_ID");
userAndGroupHandler.deleteUserGroupMembership(userId, clientId, groupId);
}

}

0 comments on commit 345a7aa

Please sign in to comment.