UNPKG

@qelos/auth

Version:

Express Passport authentication service

34 lines (33 loc) 2.88 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const api_kit_1 = require("@qelos/api-kit"); const workspace_1 = require("../controllers/workspace"); const verify_user_1 = __importDefault(require("../middleware/verify-user")); const auth_check_1 = require("../middleware/auth-check"); const router = (0, api_kit_1.getRouter)(); router .get('/api/workspaces', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaces) .get('/api/workspaces/all', verify_user_1.default, auth_check_1.onlyPrivileged, workspace_1.getEveryWorkspaces) .post('/api/workspaces', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.createWorkspace) .put('/api/workspaces/:workspaceId', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.onlyWorkspacePrivileged, workspace_1.updateWorkspace) .delete('/api/workspaces/:workspaceId', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.onlyWorkspacePrivileged, workspace_1.deleteWorkspace) .get('/api/workspaces/:workspaceId', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.getWorkspace) .get('/api/workspaces/:workspaceId/members', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.onlyWorkspacePrivileged, workspace_1.getWorkspaceMembers) .post('/api/workspaces/:workspaceId/members', verify_user_1.default, auth_check_1.onlyPrivileged, workspace_1.getWorkspaceByParams, workspace_1.addWorkspaceMember) .put('/api/workspaces/:workspaceId/members/:userId', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.onlyWorkspacePrivileged, workspace_1.updateWorkspaceMember) .delete('/api/workspaces/:workspaceId/members/:userId', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.onlyWorkspacePrivileged, workspace_1.deleteWorkspaceMember) .get('/api/workspaces/:workspaceId/encrypted', verify_user_1.default, auth_check_1.onlyPrivileged, workspace_1.getWorkspaceEncryptedData) .post('/api/workspaces/:workspaceId/encrypted', verify_user_1.default, auth_check_1.onlyPrivileged, workspace_1.setWorkspaceEncryptedData) .post('/api/workspaces/:workspaceId/activate', verify_user_1.default, auth_check_1.onlyAuthenticated, workspace_1.getWorkspaceByParams, workspace_1.activateWorkspace); router .get('/internal-api/workspaces', (req, _, next) => { req.user = { type: 'internal', isPrivileged: true, }; next(); }, workspace_1.getEveryWorkspaces); exports.default = router;