user: remove make local feature
we discussed a bit on what this does and it's confusing as it stands: * Use case of this is lost in the realms of time * Possible guess by is that it was to move users of different Cloudron to a central cloudron * Currently, the design is a bit flawed because the make user local button doesn’t pin the user. The state is lost in next synchronization. * Maybe, one should use export/import user for this use case * Let’s disable this button for now, feature is not complete.
This commit is contained in:
@@ -10,7 +10,6 @@ exports = module.exports = {
|
||||
verifyPassword,
|
||||
setGroups,
|
||||
setGhost,
|
||||
makeLocal,
|
||||
|
||||
getPasswordResetLink,
|
||||
sendPasswordResetEmail,
|
||||
@@ -204,22 +203,6 @@ async function setPassword(req, res, next) {
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
|
||||
async function makeLocal(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
if (users.compareRoles(req.user.role, req.resource.role) < 0) return next(new HttpError(403, `role '${req.resource.role}' is required but user has only '${req.user.role}'`));
|
||||
|
||||
if (req.resource.source === '') return next(new HttpError(409, 'user is already local'));
|
||||
|
||||
let [error] = await safe(users.update(req.resource, { source: '', inviteToken: '' }, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
[error] = await safe(users.sendPasswordResetEmail(req.resource, req.resource.fallbackEmail || req.resource.email, AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204, {}));
|
||||
}
|
||||
|
||||
// This will always return a reset link, if none is set or expired a new one will be created
|
||||
async function getPasswordResetLink(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
Reference in New Issue
Block a user