transfer ownership is not used anymore
This commit is contained in:
@@ -10,7 +10,6 @@ exports = module.exports = {
|
||||
verifyPassword,
|
||||
setGroups,
|
||||
setGhost,
|
||||
makeOwner,
|
||||
makeLocal,
|
||||
|
||||
getPasswordResetLink,
|
||||
@@ -202,20 +201,6 @@ async function setPassword(req, res, next) {
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
|
||||
// This route transfers ownership from token user to user specified in path param
|
||||
async function makeOwner(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
// first make new one owner, then demote current one
|
||||
let [error] = await safe(users.update(req.resource, { role: users.ROLE_OWNER }, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
[error] = await safe(users.update(req.user, { role: users.ROLE_USER }, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
|
||||
async function makeLocal(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user