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.
199524
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'));
		}
	}
1080840
function checkGroup(query, group) {
    if (group instanceof Array) {
      // check each condition from group
      for ( var c in group) {
        check(query, group[c]);
      }
    }
  }
640928
public function setGroups($groups=null) {
		if(!is_array($groups) && $groups !== null)
			$groups = [$groups];
		$this->groups = $groups;
		return $this;
	}
666926
def group_authenticated(self, user_token, group):
        
        if self.authenticated(user_token):
            token = self.token_storage.get(user_token)
            groups = self.get_groups(token.username)
            if group in groups:
                return True

        return False
1244429
private function resolveGroupCollections(array $groups = [])
    {
        foreach ($groups as $index => $group) {
            // register group
            RouteCollector::$firing['group'] = $group;

            app()->call($group['callback'], [app('route')]);

            // unregister the route
            unset(RouteCollector::$firing['group']);
            RouteCollector::removeGroup($index);
        }

        return RouteCollector::getRoutes();
    }
1097713
protected function addGroups(Collection $groups)
    {
        foreach ($groups as $group) {
            $this->groups[] = $group->token;
            $this->addRoles($group->roles);
            $this->addPermissions($group->permissions);
        }
    }
420632
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> List<T> getUsersInGroup(String groupId) {
	    Collection<User> sfsUsers = getZone().getUsersInGroup(groupId);
	    List<T> anwser = new ArrayList<>();
	    for(User sfsUser : sfsUsers)
	        if(sfsUser.containsProperty(APIKey.USER))
	            anwser.add((T) sfsUser.getProperty(APIKey.USER));
	    return anwser;
	}
645877
private void addGroup(List<Token> group, List<List<Token>> groups) {

    if(group.isEmpty()) return;

    // remove trailing tokens that should be ignored
    while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains(
        group.get(group.size() - 1).getType())) {
      group.remove(group.size() - 1);
    }

    // if the group still has some tokens left, we'll add it to our list of groups
    if(!group.isEmpty()) {
      groups.add(group);
    }
  }
589764
public void setServerGroups(java.util.Collection<ServerGroup> serverGroups) {
        if (serverGroups == null) {
            this.serverGroups = null;
            return;
        }

        this.serverGroups = new java.util.ArrayList<ServerGroup>(serverGroups);
    }
654897
def api_groups!
      synchronize do
        @api_groups = @transport.get(
          '/apis',
          response_class: K8s::API::MetaV1::APIGroupList
        ).groups.flat_map{ |api_group| api_group.versions.map(&:groupVersion) }

        @api_clients.clear
      end

      @api_groups
    end
694799
function() {
		this._groups = [];
		var group_labels = this.timescale.getGroupLabels();

		if (group_labels) {
			this.options.has_groups = true;
			for (var i = 0; i < group_labels.length; i++) {
				this._createGroup(group_labels[i]);
			}
		}

	}
203285
public function setAccessGroups( $groups )
    {
        $this->accessGroups = array_unique(
            is_array( $groups ) ? $groups : preg_split( '/[,\s]+/', $groups )
        );

        return $this;
    }
338527
public function group($name, $settings = null, $callback = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        $groupName = trim($name, '/');
        $group = [];
        $group['route'] = '/' . $groupName;
        $group['before'] = $group['after'] = null;

        if (is_null($callback)) {
            $callback = $settings;
        } else {
            $group['before'][] = (!isset($settings['before']) ? null : $settings['before']);
            $group['after'][]  = (!isset($settings['after']) ? null : $settings['after']);
        }

        $groupCount = count($this->groups);
        if ($groupCount > 0) {
            $list = [];
            foreach ($this->groups as $key => $value) {
                if (is_array($value['before'])) {
                    foreach ($value['before'] as $k => $v) {
                        $list['before'][] = $v;
                    }
                    foreach ($value['after'] as $k => $v) {
                        $list['after'][] = $v;
                    }
                }
            }

            if (! is_null($group['before'])) {
                $list['before'][] = $group['before'][0];
            }

            if (! is_null($group['after'])) {
                $list['after'][] = $group['after'][0];
            }

            $group['before'] = $list['before'];
            $group['after'] = $list['after'];
        }

        $group['before'] = array_values(array_unique( (array) $group['before']));
        $group['after'] = array_values(array_unique( (array) $group['after']));

        array_push($this->groups, $group);

        if (is_object($callback)) {
            call_user_func_array($callback, [$this]);
        }

        $this->endGroup();

        return true;
    }
162489
public function hasGroup($group)
    {
        if ($this->user() === null) {
            return null;
        }

        return in_array($group, $this->groups, true);
    }
1022032
def store_groups_in_session(sender, user, request, **kwargs):
    
    if hasattr(user, 'groups'):
        request.session['ws4redis:memberof'] = [g.name for g in user.groups.all()]
18033
@SafeVarargs
    public final OptionsConfig hideGroups(final Class<Enum>... groups) {
        hiddenGroups.addAll(Arrays.asList(groups));
        return this;
    }
60557
function isHelperGroup(helpers) {
  if (!helpers) return false;
  if (typeof helpers === 'function' || isObject(helpers)) {
    var len = Object.keys(helpers).length;
    var min = helpers.async ? 1 : 0;
    return helpers.isGroup === true || len > min;
  }
  if (Array.isArray(helpers)) {
    return helpers.isGroup === true;
  }
  return false;
}