use of com.netflix.spinnaker.front50.model.notification.HierarchicalLevel in project front50 by spinnaker.
the class NotificationController method listByApplication.
@PostAuthorize("hasPermission(#name, 'APPLICATION', 'READ')")
@RequestMapping(value = "{type}/{name}", method = RequestMethod.GET)
public Notification listByApplication(@PathVariable(value = "type") String type, @PathVariable(value = "name") String name) {
HierarchicalLevel level = getLevel(type);
final Notification notification = notificationDAO.get(level, name);
if (level.equals(HierarchicalLevel.APPLICATION)) {
final Object global = getGlobal();
NotificationDAO.NOTIFICATION_FORMATS.forEach(it -> {
if (UntypedUtils.hasProperty(global, it)) {
if (!UntypedUtils.hasProperty(notification, it)) {
UntypedUtils.setProperty(notification, it, new ArrayList<>());
}
((List) UntypedUtils.getProperty(notification, it)).addAll((List) UntypedUtils.getProperty(global, it));
}
});
}
return notification;
}
use of com.netflix.spinnaker.front50.model.notification.HierarchicalLevel in project front50 by spinnaker.
the class NotificationController method delete.
@PreAuthorize("@fiatPermissionEvaluator.storeWholePermission() and hasPermission(#name, 'APPLICATION', 'WRITE')")
@RequestMapping(value = "{type}/{name}", method = RequestMethod.DELETE)
public void delete(@PathVariable(value = "type") String type, @PathVariable(value = "name") String name) {
HierarchicalLevel level = getLevel(type);
notificationDAO.delete(level, name);
}
Aggregations