Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/api/2.0/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ var addUser = controller({success: 201}, function(req, res) {
return accountService.listUsers();
})
.then(function(users) {
if(!users.length && localUserException && res.locals.ipAddress === '127.0.0.1') {
if((!users.length && localUserException && res.locals.ipAddress === '127.0.0.1') || _.isEmpty(_.filter(users, {role: 'Administrator'}))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring this.

// Only when there are no users, and the remote is a local connection, and we
// permit it, then let them add the first user.
// Added backdoor process to add an Administrator, in case there are none.
return accountService.createUser(userObj)
.then(function(user) {
return _.pick(user, ['username', 'role']);
Expand Down