Skip to content

Commit

Permalink
Fx: users and roles needs login for admin only to be accessed
Browse files Browse the repository at this point in the history
  • Loading branch information
MugemaneBertin2001 committed Jul 4, 2024
1 parent 71be085 commit d310838
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/routes/roleRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isPasswordOutOfDate } from '../middlewares/isPasswordOutOfDate';
const RoleRouter = express.Router();

RoleRouter.post('/', isLoggedIn,isPasswordOutOfDate, isAdmin, validateSchema(roleSchema), roleController.createRole);
RoleRouter.get('/',roleController.getRoles);
RoleRouter.get('/',isLoggedIn,isAdmin,roleController.getRoles);
RoleRouter.patch('/:id', isLoggedIn,isPasswordOutOfDate, isAdmin, validateSchema(roleSchema),roleController.updateRole);
RoleRouter.delete('/:id', isLoggedIn,isPasswordOutOfDate, isAdmin, roleController.deleteRole);

Expand Down
2 changes: 1 addition & 1 deletion src/routes/userRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { isPasswordOutOfDate } from "../middlewares/isPasswordOutOfDate";
import { isVerified } from "../middlewares/isVerified";
const userRoutes = Router();

userRoutes.get("/", fetchAllUsers);
userRoutes.get("/",isLoggedIn,isAdmin, fetchAllUsers);
userRoutes.put("/passwordupdate", isLoggedIn, validateSchema(passwordUpdateSchema), updatePassword)
userRoutes.post("/login", emailValidation,validateSchema(logInSchema),isDisabled,isVerified,userLogin);
userRoutes.post("/register", emailValidation, validateSchema(signUpSchema), createUserController);
Expand Down

0 comments on commit d310838

Please sign in to comment.