}
// delete the user groups
public synchronized void deleteGroup(String groupName, String securityToken) {
AccessList accessList = getAccessListFromSecurityToken(securityToken);
Map<String, List<String>> groupMap = new HashMap<String, List<String>>();
try {
Session session = repositoryManager.getSession();
Node groups = (Node)session.getItem("/" + USER_STORE + "/" + ALL_GROUPS);
if (groups.hasNode(groupName)) {
Node groupNode = groups.getNode(groupName);
if (accessList.getUserId().equals(SUPER_ADMIN) || groupNode.hasProperty(GROUP_OWNER)
&& accessList.getUserId().equals(JCREncoder.toNormalFormat(groupNode.getProperty(GROUP_OWNER)
.getString()))) {
// deleting the accessList of the users
for (String userId : groupNode.getProperty(GROUP_USERS).getString().split(",")) {
removeAccessList(JCREncoder.toNormalFormat(userId));
}
groupNode.remove();
Node roles = (Node)session.getItem("/" + USER_STORE + "/" + ALL_ROLES);
NodeIterator roleNodes = roles.getNodes();
while (roleNodes.hasNext()) {
Node roleNode = roleNodes.nextNode();
NodeIterator albumNodes = roleNode.getNodes();
while (albumNodes.hasNext()) {
Node albumNode = albumNodes.nextNode();
if (isUserTheOwner(accessList.getUserId(), albumNode.getName())) {
String userGroups;
if (!roleNode.getName().equals(ALL_USERS_VIEW_ROLE)) {
userGroups = albumNode.getProperty(ROLE_USER_GROUPS).getString();
userGroups = (userGroups + ",").replace(groupName + ",", "");
if (userGroups.trim().equals("")) {