Is something is dropped on a group, add people to group
506229
function (uris) {
                uris.forEach(function (u) {
                  console.log('Dropped on group: ' + u)
                  var thing = kb.sym(u)
                  var toBeFetched = [thing.doc(), group.doc()]

                  kb.fetcher.load(toBeFetched).then(function (xhrs) {
                    var types = kb.findTypeURIs(thing)
                    for (var ty in types) {
                      console.log('    drop object type includes: ' + ty) // @@ Allow email addresses and phone numbers to be dropped?
                    }
                    if (ns.vcard('Individual').uri in types || ns.vcard('Organization').uri in types) {
                      var pname = kb.any(thing, ns.vcard('fn'))
                      if (!pname) return alert('No vcard name known for ' + thing)
                      var already = kb.holds(group, ns.vcard('hasMember'), thing, group.doc())
                      if (already) return alert('ALREADY added ' + pname + ' to group ' + name)
                      var message = 'Add ' + pname + ' to group ' + name + '?'
                      if (confirm(message)) {
                        var ins = [ $rdf.st(group, ns.vcard('hasMember'), thing, group.doc()),
                          $rdf.st(thing, ns.vcard('fn'), pname, group.doc())]
                        kb.updater.update([], ins, function (uri, ok, err) {
                          if (!ok) return complain('Error adding member to group ' + group + ': ' + err)
                          console.log('Added ' + pname + ' to group ' + name)
                          // @@ refresh UI
                        })
                      }
                    }
                  }).catch(function (e) {
                    complain('Error looking up dropped thing ' + thing + ' and group: ' + e)
                  })
                })
              }
557050
public function addGroup($group) {
    if (!$group->inArray((array) $this->groups)) {
      $this->groups[] = $group;
      return $this->groups;
    }
    return true;
  }
115090
function ContactsGroupsMembersAdd(options, groupId, contactId) {
    ActionAbstract.call(this, options);
    this._groupId = groupId;
    this._contactId = contactId;
}
377829
void doGroupEnd(String group, Object args) {
    checkOpen();
    JsonObject message = createMessage(args)
        .putString("action", "endGroup")
        .putString("group", group);
    if (open && !paused) {
      if (log.isDebugEnabled()) {
        log.debug(String.format("%s - Group end: Group[group=%s, args=%s]", this, group, args));
      }
      eventBus.send(inAddress, message);
    }
    groups.remove(group);
  }
671858
function(elements) {

        // first elment is in the first group
        // @TODO maybe i dont need this?
        var groups = [[elements[0]]];

        for(var i = 1; i < elements.length; i++) {
            var elementNew = elements[i];
            var addedToGroup = false;
            for(var j = 0; j < groups.length; j++) {
                var group = groups[j];
                var elementGroup = group[0];
                if(this.checkSimilarElements(elementNew, elementGroup)) {
                    group.push(elementNew);
                    addedToGroup = true;
                    break;
                }
            }

            // add new group
            if(!addedToGroup) {
                groups.push([elementNew]);
            }
        }

        return groups;
    }
879087
def add_to_team(self, **kw):
        
        group = self.context.participant_policy.title()
        data = kw.copy()
        if "groups" in data:
            data["groups"].add(group)
        else:
            data["groups"] = set([group])

        super(PloneIntranetWorkspace, self).add_to_team(**data)
225405
def group_pop(name, app, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('group:app:remove', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'app': app,
    })
409092
def invited?(user)
      self.friend_ids.include?(user.id) or self.pending_friend_ids.include?(user.id)
    end
797114
def has_group(user, group_name):
    '''
    
    '''
    if user.groups.filter(name=group_name).exists():
        return True
    return False
1070295
public function addGroup(Group $group)
    {
        $this->hasGroupsProperty();

        if (!$this->groups->contains($group)) {
            $this->groups->add($group);
        }
    }
507993
protected function groupByPending()
    {
        $column = $this->pending['groupBy'];

        $grouped = array();
        foreach ($this->data as $object)
        {
            $grouped[$object->{$column}][] = $object;
        }

        $this->data = $grouped;
    }
142108
def add_host_with_group(self, ip, mac, groupname):
		
		msg = OmapiMessage.open(b"host")
		msg.message.append(("create", struct.pack("!I", 1)))
		msg.message.append(("exclusive", struct.pack("!I", 1)))
		msg.obj.append(("hardware-address", pack_mac(mac)))
		msg.obj.append(("hardware-type", struct.pack("!I", 1)))
		msg.obj.append(("ip-address", pack_ip(ip)))
		msg.obj.append(("group", groupname))
		response = self.query_server(msg)
		if response.opcode != OMAPI_OP_UPDATE:
			raise OmapiError("add failed")
871693
function () {
        var foundOne
        sortGroups()

        var i
        for (i = 0; i < groupsMainTable.children.length; i++) {
          var row = groupsMainTable.children[i]
          row.trashMe = true
        }

        for (var g = 0; g < groups.length; g++) {
          // var book = groups[g][0]
          var name = groups[g][1]
          var group = groups[g][2]

          // selectedGroups[group.uri] = false
          foundOne = false

          for (i = 0; i < groupsMainTable.children.length; i++) {
            let row = groupsMainTable.children[i]
            if (row.subject && row.subject.sameTerm(group)) {
              row.trashMe = false
              foundOne = true
              break
            }
          }
          if (!foundOne) {
            var groupRow = groupsMainTable.appendChild(dom.createElement('tr'))
            groupRow.subject = group
            UI.widgets.makeDraggable(groupRow, group)

            groupRow.setAttribute('style', dataCellStyle)
            groupRow.textContent = name
            var foo = function addNewGroupRow2 (groupRow, group, name) {
              // Is something is dropped on a group, add people to group
              var handleURIsDroppedOnGroup = function (uris) {
                uris.forEach(function (u) {
                  console.log('Dropped on group: ' + u)
                  var thing = kb.sym(u)
                  var toBeFetched = [thing.doc(), group.doc()]

                  kb.fetcher.load(toBeFetched).then(function (xhrs) {
                    var types = kb.findTypeURIs(thing)
                    for (var ty in types) {
                      console.log('    drop object type includes: ' + ty) // @@ Allow email addresses and phone numbers to be dropped?
                    }
                    if (ns.vcard('Individual').uri in types || ns.vcard('Organization').uri in types) {
                      var pname = kb.any(thing, ns.vcard('fn'))
                      if (!pname) return alert('No vcard name known for ' + thing)
                      var already = kb.holds(group, ns.vcard('hasMember'), thing, group.doc())
                      if (already) return alert('ALREADY added ' + pname + ' to group ' + name)
                      var message = 'Add ' + pname + ' to group ' + name + '?'
                      if (confirm(message)) {
                        var ins = [ $rdf.st(group, ns.vcard('hasMember'), thing, group.doc()),
                          $rdf.st(thing, ns.vcard('fn'), pname, group.doc())]
                        kb.updater.update([], ins, function (uri, ok, err) {
                          if (!ok) return complain('Error adding member to group ' + group + ': ' + err)
                          console.log('Added ' + pname + ' to group ' + name)
                          // @@ refresh UI
                        })
                      }
                    }
                  }).catch(function (e) {
                    complain('Error looking up dropped thing ' + thing + ' and group: ' + e)
                  })
                })
              }
              UI.widgets.makeDropTarget(groupRow, handleURIsDroppedOnGroup)

              UI.widgets.deleteButtonWithCheck(dom, groupRow, 'group ' + name, function () {
                deleteThing(group)
                syncGroupTable()
              })
              groupRow.addEventListener('click', function (event) {
                event.preventDefault()
                var groupList = kb.sym(group.uri.split('#')[0])
                if (!event.metaKey) {
                  selectedGroups = {} // If Command key pressed, accumulate multiple
                }
                selectedGroups[group.uri] = !selectedGroups[group.uri]
                refreshGroupsSelected()
                peopleMainTable.innerHTML = '' // clear in case refreshNames doesn't work for unknown reason

                kb.fetcher.nowOrWhenFetched(groupList.uri, undefined, function (ok, message) {
                  if (!ok) return complainIfBad(ok, "Can't load group file: " + groupList + ': ' + message)
                  refreshNames()

                  if (!event.metaKey) { // If only one group has beeen selected show ACL
                    cardMain.innerHTML = ''
                    var visible = false
                    var aclControl = UI.aclControl.ACLControlBox5(group, dom, 'group', kb, function (ok, body) {
                      if (!ok) cardMain.innerHTML = 'Failed: ' + body
                    })
                    var sharingButton = cardMain.appendChild(dom.createElement('button'))
                    sharingButton.style.cssText = 'padding: 1em; margin: 1em'
                    var img = sharingButton.appendChild(dom.createElement('img'))
                    img.style.cssText = 'width: 1.5em; height: 1.5em'
                    img.setAttribute('src', UI.icons.iconBase + 'noun_123691.svg')
                    sharingButton.addEventListener('click', function () {
                      visible = !visible
                      if (visible) {
                        cardMain.appendChild(aclControl)
                      } else {
                        cardMain.removeChild(aclControl)
                      }
                    })
                  }
                })
              }, true)
            }
            foo(groupRow, group, name)
          } // if not foundOne
        } // loop g

        for (i = 0; i < groupsMainTable.children.length; i++) {
          let r = groupsMainTable.children[i]
          if (r.trashMe) {
            groupsMainTable.removeChild(r)
          }
        }
        refreshGroupsSelected()
      }
1323773
function add_group() {
    server.EntryGroupNew(function(err, path) {
      if (err) {
        sails.log.error('DBus: Could not call org.freedesktop.Avahi.Server.EntryGroupNew');
        return;
      }
      service.getInterface(
        path,
        avahi.DBUS_INTERFACE_ENTRY_GROUP.value,
        function (
          err,
          newGroup
        ) {
          group = newGroup;
          add_service();
        }
      )
    });
  }
558131
def groups_invite(self, room_id, user_id, **kwargs):
        """"""
        return self.__call_api_post('groups.invite', roomId=room_id, userId=user_id, kwargs=kwargs)
1180323
def add(self, item, group_by=None):
        """"""
        key = None

        if not group_by:
            group_by = self.group_by

        if group_by:
            # if group_by is a function, use it with item as argument
            if hasattr(group_by, '__call__'):
                key = group_by(item)

            # if the item has attribute of group_by as string, use that as key
            elif isinstance(group_by, str) and hasattr(item, group_by):
                key = getattr(item, group_by)

            else:
                key = None
                # try to match str(item) with regular expression
                if isinstance(group_by, str):
                    match = re.search(group_by, str(item))
                    if match:
                        if len(match.groups()) > 0:
                            key = match.group(1)
                        else:
                            key = match.group()

        self.groups.setdefault(key, list()).append(item)
886044
def add(error, group_name = :base)
      if error.is_a?(String)
        @error_messages[group_name.to_sym] << error
      elsif error.is_a?(Array)
        @error_messages[group_name.to_sym] += error
      end
    end