Преглед изворни кода

Fixed issue with stations not returning if one won't be returned.

KrisVos130 пре 8 година
родитељ
комит
aeb7b9410a
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      backend/logic/actions/stations.js

+ 5 - 5
backend/logic/actions/stations.js

@@ -101,21 +101,21 @@ module.exports = {
 					async.waterfall([
 						(next) => {
 							if (station.privacy === 'public') return next(true);
-							if (!session.sessionId) return next(false);
+							if (!session.sessionId) return next(`Insufficient permissions.`);
 							cache.hget('sessions', session.sessionId, next);
 						},
 
 						(session, next) => {
-							if (!session) return next(false);
+							if (!session) return next(`Insufficient permissions.`);
 							db.models.user.findOne({_id: session.userId}, next);
 						},
 
 						(user, next) => {
-							if (!user) return next(false);
+							if (!user) return next(`Insufficient permissions.`);
 							if (user.role === 'admin') return next(true);
-							if (station.type === 'official') return next(false);
+							if (station.type === 'official') return next(`Insufficient permissions.`);
 							if (station.owner === session.userId) return next(true);
-							next(false);
+							next(`Insufficient permissions.`);
 						}
 					], (err) => {
 						if (err === true) resultStations.push(station);