Skip to content
Snippets Groups Projects

Cherry-pick admin capabilities from SLS

Merged Ghost User requested to merge admin-cherry into main
12 files
+ 465
86
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -78,7 +78,7 @@ exports.postProfileData = async (req, res) => {
};
exports.getAllUsers = async (req, res) => {
User.findAll({attributes: ["user_id", "first_name", "last_name", "level_of_user", "team"]}).then(data =>
User.findAll({attributes: ["user_id", "first_name", "last_name", "level_of_user", "team", "email", "verified"]}).then(data =>
res.send(data)
).catch(err => {
res.status(responseStatusCodes.InternalServerError).send({
@@ -119,8 +119,42 @@ exports.getAllEmailAddressesForEditors = async () => {
logger.error(err.message);
return null;
});
};
exports.updateUserVerification = async (req, res) => {
updateUser(req.body.user_id, {verified:req.body.verified}).then(data => {
if (data) {
res.send(data);
} else {
res.status(responseStatusCodes.NotFound).send({
message: "Cannot find User."
});
}
})
.catch(err => {
res.status(responseStatusCodes.InternalServerError).send({
message: err.message || "Error updating User"
});
}
);
};
exports.updateUserTeam = async (req, res) => {
updateUser(req.body.user_id, {team:req.body.team}).then(data => {
if (data) {
res.send(data);
} else {
res.status(responseStatusCodes.NotFound).send({
message: "Cannot find User."
});
}
})
.catch(err => {
res.status(responseStatusCodes.InternalServerError).send({
message: err.message || "Error updating User"
});
}
);
};
function updateUser(user_id, user_data){
Loading