auth0-extensions/auth0-sso-dashboard-extension

View on GitHub
server/lib/user.js

Summary

Maintainability
A
0 mins
Test Coverage
D
66%
import _ from 'lodash';

/*
 * Determine if user has required group to access to application.
 */
// eslint-disable-next-line import/prefer-default-export
export const hasGroup = (userGroups, appGroups) => {
  if (!userGroups || !appGroups || !appGroups.length) {
    return true;
  }

  const intersection = _.intersection(userGroups, appGroups);
  return intersection && intersection.length >= 1;
};