UserData user = doFindUser(username);
addPermissionsToSet(user.getPermissionSet(), permission);
}
private static PermissionData convertPermissionToPermissionData(Permission permission) {
PermissionData permissionData = new PermissionData();
String type = permission.getClass().getName();
permissionData.setType(type);
Map<String, EntryValue> entryMap = EntryUtils.convertBeanToEntryMap(permission);
// copy the map, because JPA does not like the transformed map for some reason
entryMap = Maps.newHashMap(entryMap);
permissionData.setAttributes(entryMap);
return permissionData;
}