lib/localUserMiddleware.js
function groupMembershipMiddleware(groups) {
		if (typeof groups === 'string') {
			groups = [groups];
		}
		return function hasGroupMembership(req, res, next) {
			if (req.locals.user) {
				const userGroups = req.locals.user.groups || [];
				for (let group of groups) {
					if (userGroups.indexOf(group) !== -1) {
						debug(`User has the '${group}' Group.`);
						return next();
					}
				}
			}
			debug(`User is not a member of one of [${groups.join(',')}] Group(s).`);
			next(new restifyErrors.ForbiddenError('No execute permissions on endpoint'));
		}
	}
function groupMembershipMiddleware(groups) {
		if (typeof groups === 'string') {
			groups = [groups];
		}
		return function hasGroupMembership(req, res, next) {
			if (req.locals.user) {
				const userGroups = req.locals.user.groups || [];
				for (let group of groups) {
					if (userGroups.indexOf(group) !== -1) {
						debug(`User has the '${group}' Group.`);
						return next();
					}
				}
			}
			debug(`User is not a member of one of [${groups.join(',')}] Group(s).`);
			next(new restifyErrors.ForbiddenError('No execute permissions on endpoint'));
		}
	}
function groupMembershipMiddleware ( groups ) { if ( typeof groups === 'string' ) { groups = [ groups ] ; } return function hasGroupMembership ( req , res , next ) { if ( req . locals . user ) { const userGroups = req . locals . user . groups || [ ] ; for ( let group of groups ) { if ( userGroups . indexOf ( group ) !== - 1 ) { debug ( ` ${ group } ` ) ; return next ( ) ; } } } debug ( ` ${ groups . join ( ',' ) } ` ) ; next ( new restifyErrors . ForbiddenError ( 'No execute permissions on endpoint' ) ) ; } }
api configs 
Create a middleware that confirms whether a
logged in user has one of the specified Groups.

@param {string or Array} groups one or more Group codes that are required for this route.
api configs Create a middleware that confirms whether a logged in user has one of the specified Groups .