Merge pull request #37 from yareda/setpermissionforuser

Fix for missing project and repositorySlug on SetPermissionForUser function
This commit is contained in:
George Fleury
2019-12-31 11:10:31 +01:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@ -9699,11 +9699,13 @@ func (a *DefaultApiService) SetPermissionForGroups_32(localVarOptionals map[stri
/* DefaultApiService
Promote or demote a user's permission level for the specified repository. Available repository permissions are: <ul> <li>REPO_READ</li> <li>REPO_WRITE</li> <li>REPO_ADMIN</li> </ul> See the <a href=\"https://confluence.atlassian.com/display/BitbucketServer/Using+repository+permissions\">Bitbucket Server documentation</a> for a detailed explanation of what each permission entails. <p> The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a project or global permission that already implies that permission.
* @param ctx context.Context for authentication, logging, tracing, etc.
@param "projectKey" (string) name of the project to grant permission to
@param "repositorySlug" (string) repository slug
@param optional (nil or map[string]interface{}) with one or more of:
@param "name" (string) the names of the users
@param "permission" (string) the permission to grant
@return */
func (a *DefaultApiService) SetPermissionForUser(localVarOptionals map[string]interface{}) (*APIResponse, error) {
func (a *DefaultApiService) SetPermissionForUser(projectKey string, repositorySlug string, localVarOptionals map[string]interface{}) (*APIResponse, error) {
var (
localVarHTTPMethod = strings.ToUpper("Put")
localVarPostBody interface{}
@ -9713,6 +9715,8 @@ func (a *DefaultApiService) SetPermissionForUser(localVarOptionals map[string]in
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/users"
localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
@ -9763,7 +9767,7 @@ func (a *DefaultApiService) SetPermissionForUser(localVarOptionals map[string]in
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
}
return NewBitbucketAPIResponse(localVarHTTPResponse)
return NewAPIResponse(localVarHTTPResponse), nil
}
/* DefaultApiService