/**
  * Retrieve list of user groups.
  *
  * @param headers
  * @return
  * @throws IOException
  * @throws JargonException
  */
 @RequestMapping(value = "/services/usergroups", method = RequestMethod.GET)
 @ResponseBody
 public UserGroupListMetadata getUserGroups() throws JargonException, IOException {
   IRODSAccount irodsAccount =
       (IRODSAccount) request.getSession().getAttribute("SPRING_SECURITY_CONTEXT");
   UserGroupAO userGroupAO = irodsAccessObjectFactory.getUserGroupAO(irodsAccount);
   UserGroupListMetadata groups = new UserGroupListMetadata(userGroupAO.findAll());
   return groups;
 }
 /**
  * Retrieve list of user groups.
  *
  * @param headers
  * @param username
  * @return
  * @throws IOException
  * @throws JargonException
  */
 @RequestMapping(value = "/services/usergroups/{groupname}/users", method = RequestMethod.GET)
 @ResponseBody
 public UserListMetadata getUserGroupMembers(@PathVariable("groupname") String groupname)
     throws JargonException, IOException {
   IRODSAccount irodsAccount =
       (IRODSAccount) request.getSession().getAttribute("SPRING_SECURITY_CONTEXT");
   UserGroupAO userGroupAO = irodsAccessObjectFactory.getUserGroupAO(irodsAccount);
   UserListMetadata users = new UserListMetadata(userGroupAO.listUserGroupMembers(groupname));
   return users;
 }