diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-04 22:32:36 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-04 22:33:38 +0200 |
commit | 9bd2662976a75d3b03364cdbe6419e57c80f99a6 (patch) | |
tree | 0b5289660f843a8ba7f13aa79d458f53c94b36d9 /server/initializers/installer.js | |
parent | e4c556196d7b31111f17596840d2e1d60caa7dcb (diff) | |
download | PeerTube-9bd2662976a75d3b03364cdbe6419e57c80f99a6.tar.gz PeerTube-9bd2662976a75d3b03364cdbe6419e57c80f99a6.tar.zst PeerTube-9bd2662976a75d3b03364cdbe6419e57c80f99a6.zip |
Implement user API (create, update, remove, list)
Diffstat (limited to 'server/initializers/installer.js')
-rw-r--r-- | server/initializers/installer.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/initializers/installer.js b/server/initializers/installer.js index 32830d4da..c12187871 100644 --- a/server/initializers/installer.js +++ b/server/initializers/installer.js | |||
@@ -9,6 +9,7 @@ const path = require('path') | |||
9 | const series = require('async/series') | 9 | const series = require('async/series') |
10 | 10 | ||
11 | const checker = require('./checker') | 11 | const checker = require('./checker') |
12 | const constants = require('./constants') | ||
12 | const logger = require('../helpers/logger') | 13 | const logger = require('../helpers/logger') |
13 | const peertubeCrypto = require('../helpers/peertube-crypto') | 14 | const peertubeCrypto = require('../helpers/peertube-crypto') |
14 | 15 | ||
@@ -34,7 +35,7 @@ function installApplication (callback) { | |||
34 | }, | 35 | }, |
35 | 36 | ||
36 | function createOAuthUser (callbackAsync) { | 37 | function createOAuthUser (callbackAsync) { |
37 | createOAuthUserIfNotExist(callbackAsync) | 38 | createOAuthAdminIfNotExist(callbackAsync) |
38 | } | 39 | } |
39 | ], callback) | 40 | ], callback) |
40 | } | 41 | } |
@@ -80,7 +81,7 @@ function createOAuthClientIfNotExist (callback) { | |||
80 | }) | 81 | }) |
81 | } | 82 | } |
82 | 83 | ||
83 | function createOAuthUserIfNotExist (callback) { | 84 | function createOAuthAdminIfNotExist (callback) { |
84 | checker.usersExist(function (err, exist) { | 85 | checker.usersExist(function (err, exist) { |
85 | if (err) return callback(err) | 86 | if (err) return callback(err) |
86 | 87 | ||
@@ -90,6 +91,7 @@ function createOAuthUserIfNotExist (callback) { | |||
90 | logger.info('Creating the administrator.') | 91 | logger.info('Creating the administrator.') |
91 | 92 | ||
92 | const username = 'root' | 93 | const username = 'root' |
94 | const role = constants.USER_ROLES.ADMIN | ||
93 | let password = '' | 95 | let password = '' |
94 | 96 | ||
95 | // Do not generate a random password for tests | 97 | // Do not generate a random password for tests |
@@ -105,7 +107,8 @@ function createOAuthUserIfNotExist (callback) { | |||
105 | 107 | ||
106 | const user = new User({ | 108 | const user = new User({ |
107 | username: username, | 109 | username: username, |
108 | password: password | 110 | password: password, |
111 | role: role | ||
109 | }) | 112 | }) |
110 | 113 | ||
111 | user.save(function (err, createdUser) { | 114 | user.save(function (err, createdUser) { |