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.

622 B
Raw Blame
import type { NextFunction, Request, Response } from 'express';
import { GoalPermissions } from '../../../types/auth.types';
import { resolveProjectId } from './resolveProjectId';

export const CanViewIntegrations = async (req: Request, res: Response, next: NextFunction) => {
    const projectId = await resolveProjectId(req);
    if (!projectId) {
        return res.status(400).end();
    }

    const checker = await req.appUser.permissionsFetcher.getCheckerForGoal(projectId);
    if (checker.hasPermissions(GoalPermissions.INTEGRATIONS_CAN_VIEW)) {
        return next();
    }

    return res.status(403).end();
};