2016-01-25 15:54:21 +01:00
|
|
|
class UserRoutesAuthorizationService
|
|
|
|
|
2016-01-26 15:52:05 +01:00
|
|
|
def self.authorized_route? controller, dossier
|
|
|
|
auth = controller.route_authorization
|
2016-01-25 15:54:21 +01:00
|
|
|
|
2016-01-26 15:52:05 +01:00
|
|
|
auth[:states].include?(dossier.state.to_sym) &&
|
|
|
|
(auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto)
|
2016-01-25 15:54:21 +01:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|