-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#278): check token when creat/update project with token #280
Conversation
token should has authority of repo
Can one of the admins verify this patch? |
} | ||
case api.SVN: | ||
return fmt.Errorf("SCM %s is not supported", scmType) | ||
default: | ||
return fmt.Errorf("SCM type %s is unknow", scmType) | ||
} | ||
|
||
// Update the token if generate a new one. | ||
config.Token = token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new variable generatedToken
for generated token, and check its value here. If it is empty, then check the token of the config, otherwise set the generated token to the config. What about this implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggestion in comments will reduce the duplicated code, and make the code much clearer.
If oauth type is token, use private-token client instead of oauth2.0 token client
…aicloud#280) * fix(caicloud#278): check token when creat/update project with token token should has authority of repo * fix(caicloud#278): check token when creat/update project with token * fix(caicloud#278): check token when creat/update project with token If oauth type is token, use private-token client instead of oauth2.0 token client * refactor: generate token with password or check token * refactor: check gitlab token
) * fix(#278): check token when creat/update project with token token should has authority of repo * fix(#278): check token when creat/update project with token * fix(#278): check token when creat/update project with token If oauth type is token, use private-token client instead of oauth2.0 token client * refactor: generate token with password or check token * refactor: check gitlab token
Fixes ISSUE-278
Changes
Check whether the token has authority of repo when create/update project with token
Reviewers
@supereagle please review
Checklist