def joinGroup(self, group, user):
        if 'groupInvites' not in user:
            user['groupInvites'] = []

        for invite in user['groupInvites']:
            if invite['groupId'] == group['_id']:
                self.addUser(group, user, level=invite['level'])
                user['groupInvites'].remove(invite)
                self.model('user').save(user, validate=False)
                break
        else:
            if 'requests' not in group:
                group['requests'] = []

            if not user['_id'] in group['requests']:
                group['requests'].append(user['_id'])
                self.save(group, validate=False)

        return group
Return a class to use as a service for the given transport.
dataset/ETHPy150Open girder/girder/girder/models/group.py/Group.joinGroup--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/conch/ssh/factory.py/SSHFactory.getService