Skip to content

Commit e39f78c

Browse files
committed
Fix up mistakes caused by merge
1 parent 26b15da commit e39f78c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

middlewares/auth.middleware.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ function deleteResetToken(req, res, next) {
379379
* @param {(err?)=>void} next
380380
*/
381381
async function addCreationRoleBindings(req, res, next) {
382+
// Get the default role for the account type given
383+
const roleName = Constants.General.POST_ROLES[req.body.account.accountType];
384+
await Services.RoleBinding.createRoleBindingByRoleName(req.body.account.id, roleName);
382385
// Add default account role bindings
383386
await Services.RoleBinding.createRoleBindingByRoleName(req.body.account.id, Constants.Role.accountRole.name);
384387
return next();
@@ -401,12 +404,6 @@ function createRoleBindings(roleName = undefined) {
401404
* @param {*} res
402405
* @param {(err?) => void } next
403406
*/
404-
async function addSponsorRoleBindings(req, res, next) {
405-
const account = Services.Account.findById(req.body.sponsorDetails.accountId);
406-
await Services.RoleBinding.createRoleBindingByRoleName(account.id, account.accountType);
407-
return next();
408-
}
409-
410407
async function retrieveRoles(req, res, next) {
411408
const roles = await Services.Role.getAll();
412409
req.roles = roles;

0 commit comments

Comments
 (0)