Esempio n. 1
0
func (h *handlerConfiguration) createShootingHandlerFinder(prefix string) handler_finder.HandlerFinder {
	hf := rest.New(prefix)
	hf.RegisterListHandler(h.handle_errors(h.check_permission(booking_shooting_handler_list.New(h.shootingService.List, h.authorizationService.IsParticipant, h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.FindByModelId), booking_authorization.Participant)))
	hf.RegisterCreateHandler(h.handle_errors(h.check_permission(booking_shooting_handler_create.New(h.shootingService.Create), booking_authorization.Organizer)))
	hf.RegisterDeleteHandler(h.handle_errors(h.check_permission(booking_shooting_handler_delete.New(h.shootingService.Delete), booking_authorization.Organizer)))
	hf.RegisterGetHandler(h.handle_errors(h.check_permission(booking_shooting_handler_get.New(h.shootingService.Get), booking_authorization.Participant)))
	hf.RegisterUpdateHandler(h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.Update, h.shootingService.Get, h.authorizationService.IsParticipant), booking_authorization.Participant)))
	hf.RegisterPatchHandler(h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.Update, h.shootingService.Get, h.authorizationService.IsParticipant), booking_authorization.Participant)))
	hf.RegisterHandler("POST", "/book", h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.Book, h.shootingService.Get, h.authorizationService.IsParticipant), booking_authorization.Participant)))
	hf.RegisterHandler("POST", "/refuse", h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.Refuse, h.shootingService.Get, h.authorizationService.IsParticipant), booking_authorization.Participant)))
	return hf
}
func (h *handlerConfiguration) createShootingHandlerFinder(prefix string) handler_finder.HandlerFinder {
	hf := rest.New(prefix)
	hf.RegisterListHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_list.New(h.shootingService.List, h.authorizationService.IsParticipant, h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.FindByModelId), booking_authorization.Participant))))
	hf.RegisterCreateHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_create_with_user.New(h.shootingService.Create, h.shootingUserService.UpdateShootingUser, h.protocoller.AddProtocol), booking_authorization.Organizer))))
	hf.RegisterDeleteHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_delete.New(h.shootingService.Delete, h.protocoller.AddProtocol), booking_authorization.Organizer))))
	hf.RegisterGetHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_get.New(h.shootingService.Get), booking_authorization.Participant))))
	hf.RegisterUpdateHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_update_with_user.New(h.shootingService.Update, h.shootingUserService.UpdateShootingUser, h.shootingService.Get, h.protocoller.AddProtocol), booking_authorization.Organizer))))
	hf.RegisterPatchHandler(h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_update_with_user.New(h.shootingService.Update, h.shootingUserService.UpdateShootingUser, h.shootingService.Get, h.protocoller.AddProtocol), booking_authorization.Organizer))))
	hf.RegisterHandler("POST", "/book", h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingBookService.BookShooting, h.shootingService.Get, h.authorizationService.IsParticipant, h.protocoller.AddProtocol), booking_authorization.Participant))))
	hf.RegisterHandler("POST", "/refuse", h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_update.New(h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingRefuseService.RefuseShooting, h.shootingService.Get, h.authorizationService.IsParticipant, h.protocoller.AddProtocol), booking_authorization.Participant))))
	hf.RegisterHandler("GET", "/getWithUsers", h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_get_with_user.New(h.shootingService.Get, h.shootingUserService.GetUserIdsForShooting), booking_authorization.Organizer))))
	hf.RegisterHandler("GET", "/listActive", h.nocache(h.handle_errors(h.check_permission(booking_shooting_handler_list.New(h.shootingService.ListWithoutGone, h.authorizationService.IsParticipant, h.authenticationConverter.HttpRequestToAuthentication, h.modelService.GetByToken, h.shootingService.FindByModelId), booking_authorization.Participant))))
	return hf
}