use of org.onebusaway.admin.model.role.Privilege in project onebusaway-application-modules by camsys.
the class AccessControlServiceImpl method init.
@PostConstruct
private void init() throws Exception {
roleByName = new ConcurrentHashMap<String, Role>();
List<Map<String, String>> settings = _configurationServiceClient.getItems("config", "list");
if (settings == null)
throw new Exception("No configuration supplied");
for (Map<String, String> setting : settings) {
if ((setting.containsKey("component") && privilegeComponent.equals(setting.get("component"))) && setting.containsKey("key")) {
String roleName = setting.get("key");
String privListString = setting.get("value");
if (privListString.equals("*")) {
Role role = new Role(roleName, null);
roleByName.put(roleName, role);
continue;
}
Set<Privilege> privileges = new HashSet<Privilege>();
for (String privName : privListString.split(",")) {
Privilege priv = new Privilege(privName);
privileges.add(priv);
}
Role role = new Role(roleName, privileges);
roleByName.put(roleName, role);
}
}
}
Aggregations