group: cannot set name of ldap group
This commit is contained in:
@@ -6,7 +6,7 @@ exports = module.exports = {
|
||||
get,
|
||||
list,
|
||||
add,
|
||||
update,
|
||||
setName,
|
||||
remove,
|
||||
setMembers
|
||||
};
|
||||
@@ -47,15 +47,12 @@ async function get(req, res, next) {
|
||||
next(new HttpSuccess(200, req.resource));
|
||||
}
|
||||
|
||||
async function update(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.groupId, 'string');
|
||||
async function setName(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
if (req.resource.source === 'ldap') return next(new HttpError(409, 'external group cannot be updated'));
|
||||
|
||||
if ('name' in req.body && typeof req.body.name !== 'string') return next(new HttpError(400, 'name must be a string'));
|
||||
|
||||
const [error] = await safe(groups.update(req.params.groupId, req.body));
|
||||
if (typeof req.body.name !== 'string') return next(new HttpError(400, 'name must be a string'));
|
||||
const [error] = await safe(groups.setName(req.resource, req.body.name));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { }));
|
||||
|
||||
Reference in New Issue
Block a user