Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 31 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | import path from 'path' |
||
2 | import fse from 'fs-extra' |
||
3 | import Handlebars from 'handlebars' |
||
4 | import { |
||
5 | abeExtend |
||
|
|||
6 | ,coreUtils |
||
7 | ,config |
||
8 | } from '../../cli' |
||
9 | |||
10 | var route = function(req, res, next) { |
||
11 | |||
12 | var authorizations = req.body |
||
13 | |||
14 | let json = config.getLocalConfig() |
||
15 | |||
16 | Array.prototype.forEach.call(Object.keys(authorizations), (key) => { |
||
17 | if (key != "admin") { |
||
18 | json.users.routes[key] = authorizations[key] |
||
19 | } |
||
20 | }) |
||
21 | |||
22 | config.save(json) |
||
23 | |||
24 | res.set('Content-Type', 'application/json') |
||
25 | res.send(JSON.stringify({ |
||
26 | success: 1, |
||
27 | message: 'config saved' |
||
28 | })) |
||
29 | } |
||
30 | |||
31 | export default route |