For creating a new workgroup or a new group/user relationship.
3319
@Override
    @Path("/{groupName}/{'users'}/{cuid}")
    @ApiOperation(value="Create a workgroup or add a user to an existing workgroup",
        notes="If users/{cuid} is present, user is added to workgroup.", response=StatusMessage.class)
    @ApiImplicitParams({
        @ApiImplicitParam(name="Workgroup", paramType="body", required=true, dataType="com.centurylink.mdw.model.user.Workgroup"),
        @ApiImplicitParam(name="groupName", paramType="path", required=true)})
    public JSONObject post(String path, JSONObject content, Map<String,String> headers)
    throws ServiceException, JSONException {
        String name = getSegment(path, 1);
        String rel = getSegment(path, 2);

        UserServices userServices = ServiceLocator.getUserServices();
        try {
            if (rel == null) {
                Workgroup workgroup = new Workgroup(content);
                Workgroup existing = userServices.getWorkgroups().get(workgroup.getName());
                if (existing != null)
                    throw new ServiceException(HTTP_409_CONFLICT, "Workgroup name already exists: " + workgroup.getName());
                userServices.createWorkgroup(workgroup);
                headers.put(Listener.METAINFO_HTTP_STATUS_CODE, "201");
            }
            else if (rel.equals("users")) {
                String cuid = getSegment(path, 3);
                User user = UserGroupCache.getUser(cuid);
                if (user == null) {
                    throw new CachingException("Cannot find user: " + cuid);
                }
                if (user.belongsToGroup(name))  // in case added elsewhere
                    throw new ServiceException(HTTP_409_CONFLICT, "User " + cuid + " already belongs to workgroup " + name);

                userServices.addUserToWorkgroup(cuid, name);
            }
            else {
                String msg = "Unsupported relationship for workgroup " + name + ": " + rel;
                throw new ServiceException(HTTP_400_BAD_REQUEST, msg);
            }
            return null;
        }
        catch (DataAccessException ex) {
            throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
        }
        catch (CachingException ex) {
             throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
        }
    }
1163379
def create_grupo_usuario(self):
        """"""
        return GrupoUsuario(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1079980
def createGroup(self, group, vendorSpecific=None):
        
        response = self.createGroupResponse(group, vendorSpecific)
        return self._read_boolean_response(response)
514112
def cli(ctx, group, user):
    
    return ctx.gi.users.add_to_group(group, user)
63564
def create_default_access_for(permission_template:, workflow:)
        permission_template.access_grants.create(agent_type: 'group', agent_id: ::Ability.registered_group_name, access: Hyrax::PermissionTemplateAccess::DEPOSIT)
        deposit = Sipity::Role[Hyrax::RoleRegistry::DEPOSITING]
        workflow.update_responsibilities(role: deposit, agents: Hyrax::Group.new('registered'))
      end
238713
def create_grupo_equipamento(self):
        """"""
        return GrupoEquipamento(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
751041
def add(self, group_name, session):
        ''''''
        request = TOPRequest('taobao.crm.group.add')
        request['group_name'] = group_name
        self.create(self.execute(request, session), fields=['is_success', 'group_id'])
        return self.is_success, self.group_id
1200932
def create
      @access_group = Incline::AccessGroup.create(access_group_params :before_create)
      if @access_group
        if @access_group.update(access_group_params :after_create)
          handle_update_success notice: 'Access group was successfully created.'
        else
          handle_update_failure :new
        end
      else
        handle_update_failure :new
      end
    end
992264
@Override
    public ICompositeGroupService newGroupService() throws GroupsException {
        try {
            ReferenceCompositeGroupService service = new ReferenceCompositeGroupService();
            service.initializeComponentServices();
            return service;
        } catch (Exception ex) {
            log.error("ReferenceCompositeGroupServiceFactory.newGroupService(): " + ex);
            throw new GroupsException(ex);
        }
    }
776356
def add_member(user, group)
      relation = group.group_member_relations.find_or_initialize_by(user: user, accepted_at: nil)
      relation.accepted_at = Time.now
      relation.accepter = self
      relation.save
    end
55798
def group_create(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(keep_name=True, **kwargs)
    return cloud.create_group(**kwargs)
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
1270108
private Set<String> createUserOrGroupSet(
                                             Dictionary<String, Object> properties, String type) {
        SibTr.entry(tc, CLASS_NAME + "createUserOrGroupSet", new Object[] { properties, type });

        Set<String> userOrGroupSet = new HashSet<String>();
        if (properties != null) {
            String[] tempUsersOrGroups = (String[]) properties.get(type);
            if (tempUsersOrGroups != null) {
                for (String tempUserOrGroup : tempUsersOrGroups) {
                    Dictionary<String, Object> userOrGroupProperties = getDictionaryObject(tempUserOrGroup);
                    if (userOrGroupProperties != null) {
                        String userOrGroup = ((String) userOrGroupProperties
                                        .get(MessagingSecurityConstants.NAME));
                        userOrGroupSet.add(userOrGroup.trim());
                    }
                }
            }
        }

        SibTr.exit(tc, CLASS_NAME + "createUserOrGroupSet", userOrGroupSet);
        return userOrGroupSet;
    }
1201598
def add(name, **kwargs):
    '''
    
    '''
    if not info(name):
        comp_obj = _get_computer_object()
        try:
            new_group = comp_obj.Create('group', name)
            new_group.SetInfo()
            log.info('Successfully created group %s', name)
        except pywintypes.com_error as exc:
            msg = 'Failed to create group {0}. {1}'.format(
                name, win32api.FormatMessage(exc.excepinfo[5]))
            log.error(msg)
            return False
    else:
        log.warning('The group %s already exists.', name)
        return False
    return True
359436
def group_add(self, name, restrict, repos, lces=[], assets=[], queries=[],
                  policies=[], dashboards=[], credentials=[], description=''):
        '''
        '''
        return self.raw_query('group', 'add', data={
            'lces': [{'id': i} for i in lces],
            'assets': [{'id': i} for i in assets],
            'queries': [{'id': i} for i in queries],
            'policies': [{'id': i} for i in policies],
            'dashboardTabs': [{'id': i} for i in dashboards],
            'credentials': [{'id': i} for i in credentials],
            'repositories': [{'id': i} for i in repos],
            'definingAssets': [{'id': i} for i in restrict],
            'name': name,
            'description': description,
            'users': [],
            'context': ''
        })
950049
def add_group(group, user=None):
    
    user = get_user(user)

    if user is None:
        raise ValueError("User '{}' not found".format(repr(user)))

    if isinstance(group, basestring):
        group = [group]
    elif isinstance(group, GroupData):
        group = [group]

    portal_groups = get_tool("portal_groups")
    for group in map(get_group, group):
        if group is None:
            continue
        portal_groups.addPrincipalToGroup(get_user_id(user), group.getId())

    return get_groups(user)
1339779
def users_create_or_update_many(self, data, **kwargs):
        ""
        api_path = "/api/v2/users/create_or_update_many.json"
        return self.call(api_path, method="POST", data=data, **kwargs)