users: cannot update profile fields of external user
This commit is contained in:
11
src/users.js
11
src/users.js
@@ -24,6 +24,7 @@ exports = module.exports = {
|
||||
|
||||
setPassword,
|
||||
setGhost,
|
||||
updateProfile,
|
||||
update,
|
||||
|
||||
del,
|
||||
@@ -633,6 +634,16 @@ async function update(user, data, auditSource) {
|
||||
});
|
||||
}
|
||||
|
||||
async function updateProfile(user, profile, auditSource) {
|
||||
assert.strictEqual(typeof user, 'object');
|
||||
assert.strictEqual(typeof profile, 'object');
|
||||
assert(auditSource && typeof auditSource === 'object');
|
||||
|
||||
if (user.source === 'ldap') throw new BoxError(BoxError.BAD_STATE, 'Cannot update profile of external auth user');
|
||||
|
||||
await update(user, profile, auditSource);
|
||||
}
|
||||
|
||||
async function getOwner() {
|
||||
const owners = await getByRole(exports.ROLE_OWNER);
|
||||
if (owners.length === 0) return null;
|
||||
|
||||
Reference in New Issue
Block a user