'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _cli = require('../../cli');

var route = function route(req, res) {

  var authorizations = req.body;

  var json = _cli.config.getLocalConfig();

  Array.prototype.forEach.call(Object.keys(authorizations), function (key) {
    if (key != 'admin') {
      json.users.routes[key] = authorizations[key];
    }
  });

  _cli.config.users.routes = json.users.routes;
  _cli.config.save(json);

  res.set('Content-Type', 'application/json');
  res.send(JSON.stringify({
    success: 1,
    message: 'config saved'
  }));
};

exports.default = route;