modules/orionode/lib/user.js
function checkUserAccess(req, res, next) {
		const isadmin = isAdmin(options, req.user.username);
		if (!req.user || !(req.params.id === req.user.username || isadmin)) {
			return api.writeResponse(403, res);
		}
		const contextPath = options.configParams.get("orion.context.path") || "",
			listenContextPath = options.configParams.get("orion.context.listenPath") || false,
			uri = url.parse(req.originalUrl.substring(listenContextPath ? contextPath.length : 0)).pathname;
		if(isadmin) {
			return next();
		}
		checkRights(req.user.username, uri, req, res, next);
	}
function checkUserAccess(req, res, next) {
		const isadmin = isAdmin(options, req.user.username);
		if (!req.user || !(req.params.id === req.user.username || isadmin)) {
			return api.writeResponse(403, res);
		}
		const contextPath = options.configParams.get("orion.context.path") || "",
			listenContextPath = options.configParams.get("orion.context.listenPath") || false,
			uri = url.parse(req.originalUrl.substring(listenContextPath ? contextPath.length : 0)).pathname;
		if(isadmin) {
			return next();
		}
		checkRights(req.user.username, uri, req, res, next);
	}
function checkUserAccess ( req , res , next ) { const isadmin = isAdmin ( options , req . user . username ) ; if ( ! req . user || ! ( req . params . id === req . user . username || isadmin ) ) { return api . writeResponse ( 403 , res ) ; } const contextPath = options . configParams . get ( "orion.context.path" ) || "" , listenContextPath = options . configParams . get ( "orion.context.listenPath" ) || false , uri = url . parse ( req . originalUrl . substring ( listenContextPath ? contextPath . length : 0 ) ) . pathname ; if ( isadmin ) { return next ( ) ; } checkRights ( req . user . username , uri , req , res , next ) ; }
Checks is the logged in user has access to the requested resource
@param {XMLHttpRequest} req The backing request
@param {XMLHttpResponse} res The response object
@param {fn} next The next function to skip ahead
Checks is the logged in user has access to the requested resource