Skip to content
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

Merged
merged 5 commits into from
Dec 12, 2017

Conversation

LiangXugang
Copy link

@LiangXugang LiangXugang commented Dec 7, 2017

Fixes ISSUE-278

Changes

  • Check whether the token has authority of repo when create/update project with token
    Reviewers

  • @supereagle please review

Checklist

  • Rebased/mergable
  • Tests pass
  • Issue/task done

@caicloud-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@LiangXugang LiangXugang changed the title fix(#278): check token when creat/update project with token WIP:fix(#278): check token when creat/update project with token Dec 8, 2017
}
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
Copy link
Member

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?

Copy link
Member

@supereagle supereagle left a 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
@LiangXugang LiangXugang changed the title WIP:fix(#278): check token when creat/update project with token fix(#278): check token when creat/update project with token Dec 11, 2017
@supereagle supereagle merged commit 17f090f into caicloud:v1-preview Dec 12, 2017
supereagle pushed a commit to supereagle/cyclone that referenced this pull request Dec 12, 2017
…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
@supereagle supereagle mentioned this pull request Dec 12, 2017
2 tasks
@LiangXugang LiangXugang deleted the check_SCM_auth branch December 12, 2017 09:09
supereagle added a commit that referenced this pull request Dec 13, 2017
)

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants