server/server/articles/articles.controller.js
/**
 * Authorize permission to perform action
 * on the loaded article by requesting user
 *
 * @param {object} req.article 	//	loaded article to perform operation
 * @param {object} req.user		//	requesting user
 */
Authorize permission to perform action
on the loaded article by requesting user

@param {object} req.article  //      loaded article to perform operation
@param {object} req.user             //      requesting user
Authorize permission to perform action on the loaded article by requesting user @param { object } req . article // loaded article to perform operation @param { object } req . user // requesting user
function authorize(req, res, next) {
	if (req.article.author.email !== req.user.email) {
		return next(
			new APIError(
				'Not authorized to perform this action',
				httpStatus.UNAUTHORIZED,
				true,
			),
		);
	}
	next();
}
function authorize ( req , res , next ) { if ( req . article . author . email !== req . user . email ) { return next ( new APIError ( 'Not authorized to perform this action' , httpStatus . UNAUTHORIZED , true , ) , ) ; } next ( ) ; }
Authorize permission to perform action
 on the loaded article by requesting user
Authorize permission to perform action on the loaded article by requesting user