demarches-normaliennes/app/services/user_routes_authorization_service.rb

9 lines
278 B
Ruby
Raw Normal View History

class UserRoutesAuthorizationService
def self.authorized_route?(controller, dossier)
2016-01-26 15:52:05 +01:00
auth = controller.route_authorization
2018-08-28 14:12:48 +02:00
auth[:states].include?(dossier.state) &&
2016-01-26 15:52:05 +01:00
(auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto)
end
2017-04-04 15:27:04 +02:00
end