Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

472 B
Raw Blame
import type { NextFunction, Request, Response } from 'express'

export const IsOrgMemberIfProvided = async (req: Request, res: Response, next: NextFunction) => {
  const organizationId = Number(
    req.query.organizationId || req.body.organizationId || req.params.organizationId
  )

  if (!organizationId) return next()

  const member = await req.appUser.organizationManager.getCurrentUserMember(organizationId)

  if (!member) return res.status(403).end()

  next()
}