mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 09:23:12 +08:00
Added auth middleware. Added access control to apps
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||||
const App = require('../../models/App');
|
||||
const ErrorResponse = require('../../utils/ErrorResponse');
|
||||
|
||||
// @desc Get single app
|
||||
// @route GET /api/apps/:id
|
||||
// @access Public
|
||||
const getSingleApp = asyncWrapper(async (req, res, next) => {
|
||||
const visibility = req.isAuthenticated ? {} : { isPublic: true };
|
||||
|
||||
const app = await App.findOne({
|
||||
where: { id: req.params.id },
|
||||
where: { id: req.params.id, ...visibility },
|
||||
});
|
||||
|
||||
if (!app) {
|
||||
|
||||
Reference in New Issue
Block a user