private IGenericSearchDAO alienDAO;
@Resource
private ResourcePermissionService resourcePermissionService;
@Resource
private ApplicationEnvironmentService applicationEnvironmentService;
<BUG>private void hasAuthorizationOrFailed(LocationResourceTemplate resourceTemplate, Subject subject, String[] names) {
Map<Subject, Set<String>> subjectsMap = new HashMap<>();</BUG>
subjectsMap.put(subject, Sets.newHashSet(names));
<BUG>if (resourcePermissionService.hasPermission(resourceTemplate, subjectsMap)) {

throw new RuntimeException("TODO: improve this exception");
}</BUG>
}

private IGenericSearchDAO alienDAO;
@Resource
private ResourcePermissionService resourcePermissionService;
@Resource
private ApplicationEnvironmentService applicationEnvironmentService;
private void hasAuthorizationOrFailed(Location resource, Subject subject, String[] names) {
Map<Subject, Set<String>> subjectsMap = new HashMap<>();
subjectsMap.put(subject, Sets.newHashSet(names));
if (!resourcePermissionService.hasPermission(resource, subjectsMap)) {
throw new AccessDeniedException("At least one of the current <" + names + "> <" + subject + "> has no authorization on location <" + resource.getName() + "> to perform the requested operation.");
}
}
