(self, user, script_name, parameter_name)
| 547 | @check_authorization |
| 548 | @inject_user |
| 549 | def get(self, user, script_name, parameter_name): |
| 550 | id = self.get_query_argument('id') |
| 551 | |
| 552 | if not id: |
| 553 | respond_error(self, 400, 'Model id is not specified') |
| 554 | return |
| 555 | |
| 556 | if id not in active_config_models: |
| 557 | respond_error(self, 400, 'Model with id=' + str(id) + ' does not exist') |
| 558 | return |
| 559 | |
| 560 | active_model = active_config_models[id] |
| 561 | config_user_id = active_model['user_id'] |
| 562 | |
| 563 | if config_user_id != user.user_id: |
| 564 | LOGGER.warning('User ' + str(user) + ' tried to access config ' |
| 565 | + script_name + ' of user #' + config_user_id) |
| 566 | respond_error(self, 400, 'Model with id=' + str(id) + ' does not exist') |
| 567 | return |
| 568 | |
| 569 | config_model = active_model['model'] |
| 570 | |
| 571 | if config_model.name != script_name: |
| 572 | LOGGER.warning( |
| 573 | 'Config name differences for #' + str(id) + '. Expected ' + config_model.name + ', got ' + script_name) |
| 574 | respond_error(self, 500, 'Failed to load script by name') |
| 575 | return |
| 576 | |
| 577 | path = self.get_query_arguments('path') |
| 578 | try: |
| 579 | files = config_model.list_files_for_param(parameter_name, path) |
| 580 | self.write(json.dumps(files)) |
| 581 | |
| 582 | except ParameterNotFoundException as e: |
| 583 | respond_error(self, 404, 'Parameter ' + e.param_name + ' does not exist') |
| 584 | return |
| 585 | except (InvalidValueException, WrongParameterUsageException) as e: |
| 586 | respond_error(self, 400, str(e)) |
| 587 | return |
| 588 | |
| 589 | |
| 590 | class LoginHandler(BaseRequestHandler): |
nothing calls this directly
no test coverage detected