//-------------------------------------------------------------------------
@Override
public Map<LiveDataSpecification, Boolean> isEntitled(UserPrincipal userPrincipal, Collection<LiveDataSpecification> requestedSpecifications) {
Map<LiveDataSpecification, Boolean> returnValue = new HashMap<LiveDataSpecification, Boolean>();
User user = _userManager.getUser(userPrincipal.getUserName());
if (user == null) {
s_logger.debug("User {} does not exist - no permissions are granted", userPrincipal.getUserName());
for (LiveDataSpecification spec : requestedSpecifications) {
returnValue.put(spec, false);
}
return returnValue;
}
Map<LiveDataSpecification, DistributionSpecification> distributionSpecs = _resolver.resolve(requestedSpecifications);
for (LiveDataSpecification requestedSpec : requestedSpecifications) {
DistributionSpecification distributionSpec = distributionSpecs.get(requestedSpec);
if (distributionSpec != null) {
String permission = distributionSpec.getJmsTopic().replace('.', '/');
boolean hasPermission = user.hasPermission(permission);
returnValue.put(requestedSpec, hasPermission);
} else {
s_logger.debug("Could not resolve live data spec {} - no permissions are granted to {}", requestedSpec, userPrincipal.getUserName());
returnValue.put(requestedSpec, false);
}