neezzzy / Final-Project-P100

capstone project for the Software Development Certificate
0 stars 1 forks source link

Restrict deletion of projects between different companies #64

Open neezzzy opened 1 year ago

neezzzy commented 1 year ago

@mdroidian @Patricia-Fargetti Currently, our app allows a company to delete any project. We want only the company that created the project to be able to delete it. Alt Text

mdroidian commented 1 year ago
      if (req.isAuthenticated) {
        const user = await User.findOne({ email: userAuth0.email });
        if (user.userType === "student") {isStudent = true;}
        if (user.userType === "company") {isCompany = true;}
      }
      const user = await User.findOne({ email: userAuth0.email });
      res.render("projects", {
        title: "Projects",
        isAuthenticated: req.isAuthenticated,
        user,
        projects,
        isStudent,
        isCompany,
      });

<% if (JSON.stringify(project.projectOwnerID._id) == JSON.stringify(user._id)) { %>