Creates a Project for a specific User

@param userId The id of the user to create the project for
@param name   The name of the project
@return The GitLab Project
@throws IOException on gitlab api call error
426840
public GitlabProject createUserProject(Integer userId, String name) throws IOException {
        return createUserProject(userId, name, null, null, null, null, null, null, null, null, null);
    }
991837
def create_project(self, data):
        """"""
        # http://teampasswordmanager.com/docs/api-projects/#create_project
        log.info('Create project: %s' % data)
        NewID = self.post('projects.json', data).get('id')
        log.info('Project has been created with ID %s' % NewID)
        return NewID
449495
public GitlabProject createProject(GitlabProject project) throws IOException {
        Query query = new Query()
                .appendIf("name", project.getName())
                .appendIf("path", project.getPath())
                .appendIf("default_branch", project.getDefaultBranch())
                .appendIf("description", project.getDescription())
                .appendIf("issues_enabled", project.isIssuesEnabled())
                .appendIf("merge_requests_enabled", project.isMergeRequestsEnabled())
                .appendIf("jobs_enabled", project.isJobsEnabled())
                .appendIf("wiki_enabled", project.isWikiEnabled())
                .appendIf("snippets_enabled", project.isSnippetsEnabled())

                .appendIf("container_registry_enabled", project.isContainerRegistryEnabled())
                .appendIf("shared_runners_enabled", project.isSharedRunnersEnabled())

                .appendIf("visibility", project.getVisibility())
                .appendIf("public_jobs", project.hasPublicJobs())
                .appendIf("import_url", project.getImportUrl())

                .appendIf("only_allow_merge_if_pipeline_succeeds", project.getOnlyAllowMergeIfPipelineSucceeds())
                .appendIf("only_allow_merge_if_all_discussions_are_resolved", project.getOnlyAllowMergeIfAllDiscussionsAreResolved())
                .appendIf("lfs_enabled", project.isLfsEnabled())
                .appendIf("request_access_enabled", project.isRequestAccessEnabled())
                .appendIf("repository_storage", project.getRepositoryStorage())
                .appendIf("approvals_before_merge", project.getApprovalsBeforeMerge())
                .appendIf("printing_merge_request_link_enabled", project.isPrintingMergeRequestLinkEnabled());

        GitlabNamespace namespace = project.getNamespace();
        if (namespace != null) {
            query.appendIf("namespace_id", namespace.getId());
        }


        String tailUrl = GitlabProject.URL + query.toString();

        return dispatch().to(tailUrl, GitlabProject.class);
    }
665714
public GitlabGroup createGroupViaSudo(String name, String path, GitlabUser sudoUser) throws IOException {
        return createGroup(name, path, null, null, sudoUser);
    }
387617
def create(project, credentials): #pylint: disable=too-many-return-statements
        """"""

        if not settings.COMMAND:
            return flask.make_response("Projects disabled, no command configured",404)

        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        if not Project.validate(project):
            return withheaders(flask.make_response('Invalid project ID. Note that only alphanumerical characters are allowed.',403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        printdebug("Checking if " + settings.ROOT + "projects/" + user + '/' + project + " exists")
        if not project:
            return withheaders(flask.make_response('No project name',403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user):
            printlog("Creating user directory '" + user + "'")
            os.makedirs(settings.ROOT + "projects/" + user)
            if not os.path.isdir(settings.ROOT + "projects/" + user): #verify:
                return withheaders(flask.make_response("Directory " + settings.ROOT + "projects/" + user + " could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})


        #checking user quota
        if settings.USERQUOTA > 0:
            _, totalsize = getprojects(user)
            if totalsize > settings.USERQUOTA:
                printlog("User " + user + " exceeded quota, refusing to create new project...")
                return withheaders(flask.make_response("Unable to create new project because you are exceeding your disk quota (max " + str(settings.USERQUOTA) + " MB, you now use " + str(totalsize) + " MB). Please delete some projects and try again.",403),headers={'allow_origin': settings.ALLOW_ORIGIN})

        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project):
            printlog("Creating project '" + project + "'")
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project)

        #project index will need to be regenerated, remove cache
        if os.path.exists(os.path.join(settings.ROOT + "projects/" + user,'.index')):
            os.unlink(os.path.join(settings.ROOT + "projects/" + user,'.index'))

        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/input/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/input")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/input'):
                return withheaders(flask.make_response("Input directory " + settings.ROOT + "projects/" + user + '/' + project + "/input/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/output/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/output")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/output'):
                return withheaders(flask.make_response("Output directory " + settings.ROOT + "projects/" + user + '/' + project + "/output/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/tmp/'):
            os.makedirs(settings.ROOT + "projects/" + user + '/' + project + "/tmp")
            if not os.path.isdir(settings.ROOT + "projects/" + user + '/' + project + '/tmp'):
                return withheaders(flask.make_response("tmp directory " + settings.ROOT + "projects/" + user + '/' + project + "/tmp/  could not be created succesfully",403),headers={'allow_origin': settings.ALLOW_ORIGIN})

        return None
257525
public static void createProjectSkeleton( File targetDirectory, CreationBean creationBean ) throws IOException {

		if( creationBean.isMavenProject())
			createMavenProject( targetDirectory, creationBean );
		else
			createSimpleProject( targetDirectory, creationBean );
	}
1236097
public GitlabProject getProject(Serializable projectId) throws IOException {
        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId);
        return retrieve().to(tailUrl, GitlabProject.class);
    }
1334185
public Project createSubProject(String name, DateTime beginDate) {
        return createSubProject(name, beginDate, null);
    }
1166641
public void deleteUser(Integer targetUserId) throws IOException {
        String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId;
        retrieve().method(DELETE).to(tailUrl, Void.class);
    }
1015647
@Post("/projects")
    @StatusCode(201)
    @ResponseConverter(CreateApiResponseConverter.class)
    public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) {
        return execute(Command.createProject(author, request.name()))
                .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name()))));
    }
364828
public CompletableFuture<Member> getMember(String projectName, User user) {
        requireNonNull(projectName, "projectName");
        requireNonNull(user, "user");

        return getProject(projectName).thenApply(
                project -> project.memberOrDefault(user.id(), null));
    }
994381
def add_project(project,**kwargs):
    
    user_id = kwargs.get('user_id')

    existing_proj = get_project_by_name(project.name,user_id=user_id)

    if len(existing_proj) > 0:
        raise HydraError("A Project with the name \"%s\" already exists"%(project.name,))

    #check_perm(user_id, 'add_project')
    proj_i = Project()
    proj_i.name = project.name
    proj_i.description = project.description
    proj_i.created_by = user_id

    attr_map = hdb.add_resource_attributes(proj_i, project.attributes)
    db.DBSession.flush() #Needed to get the resource attr's ID
    proj_data = _add_project_attribute_data(proj_i, attr_map, project.attribute_data)
    proj_i.attribute_data = proj_data

    proj_i.set_owner(user_id)

    db.DBSession.add(proj_i)
    db.DBSession.flush()

    return proj_i
527503
public void blockUser(Integer userId) throws GitLabApiException {
        if (userId == null) {
            throw new RuntimeException("userId cannot be null");
        }

        if (isApiVersion(ApiVersion.V3)) {
            put(Response.Status.CREATED, null, "users", userId, "block");
        } else {
            post(Response.Status.CREATED, (Form) null, "users", userId, "block");
        }
    }
1241712
public User findUserById(String userId) {
    return createUserQuery(org.camunda.bpm.engine.impl.context.Context.getCommandContext())
      .userId(userId)
      .singleResult();
  }
695747
public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException {
        Query query = request.toQuery();
        query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null);

        String tailUrl = GitlabGroup.URL + query.toString();

        return dispatch().to(tailUrl, GitlabGroup.class);
    }
1224526
public void transfer(Integer namespaceId, Integer projectId) throws IOException {
        Query query = new Query().append("namespace", String.valueOf(namespaceId));
        String tailUrl = GitlabProject.URL + "/" + projectId + "/transfer" + query.toString();
        retrieve().method(PUT).to(tailUrl, Void.class);
    }
1275075
public List<GitlabProject> getProjectsViaSudo(GitlabUser user) throws IOException {
        Query query = new Query()
                .appendIf(PARAM_SUDO, user.getId());
        query.mergeWith(new Pagination().withPerPage(Pagination.MAX_ITEMS_PER_PAGE).asQuery());
        String tailUrl = GitlabProject.URL + query.toString();
        return retrieve().getAll(tailUrl, GitlabProject[].class);
    }