Browse Source

Making sure roles object is always present, issue #1529.

master
mike12345567 5 years ago
parent
commit
a6e196a351
  1. 4
      packages/worker/src/api/controllers/admin/users.js

4
packages/worker/src/api/controllers/admin/users.js

@ -42,6 +42,10 @@ exports.save = async ctx => {
_id: _id || generateGlobalUserID(),
password: hashedPassword,
}
// make sure the roles object is always present
if (!user.roles) {
user.roles = {}
}
// add the active status to a user if its not provided
if (user.status == null) {
user.status = UserStatus.ACTIVE

Loading…
Cancel
Save