| 161 | @requires_admin_rights |
| 162 | @inject_user |
| 163 | def put(self, user): |
| 164 | (config, filename, uploaded_script) = self.read_config_parameters() |
| 165 | |
| 166 | try: |
| 167 | self.application.config_service.update_config(user, config, filename, uploaded_script) |
| 168 | except (InvalidConfigException, InvalidFileException) as e: |
| 169 | raise tornado.web.HTTPError(422, str(e)) |
| 170 | except ConfigNotAllowedException: |
| 171 | LOGGER.warning('Admin access to the script "' + config['name'] + '" is denied for ' + user.get_audit_name()) |
| 172 | respond_error(self, 403, 'Access to the script is denied') |
| 173 | return |
| 174 | except InvalidAccessException as e: |
| 175 | raise tornado.web.HTTPError(403, reason=str(e)) |
| 176 | |
| 177 | def read_config_parameters(self): |
| 178 | config = json.loads(self.get_argument('config')) |