users: cannot update profile fields of external user

This commit is contained in:
Girish Ramakrishnan
2024-01-20 10:41:24 +01:00
parent bd1ab000f3
commit c99c24b3bd
7 changed files with 174 additions and 93 deletions

View File

@@ -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;