diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-11-22 14:27:31 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-12-16 15:08:10 +0530 |
commit | 6c809dfae84e702f7a49d3fac5725745264e0ff9 (patch) | |
tree | 185c6d1444abd3f884515b92f077e747cac96e1d /app/controllers/profiles | |
parent | 1d0ccec6dd8375b751846f69bb170ebd11e9a391 (diff) | |
download | gitlab-ce-6c809dfae84e702f7a49d3fac5725745264e0ff9.tar.gz |
Allow creating personal access tokens / OAuth applications with scopes.
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r-- | app/controllers/profiles/personal_access_tokens_controller.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index 508b82a9a6c..6e007f17913 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -1,8 +1,6 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController - before_action :load_personal_access_tokens, only: :index - def index - @personal_access_token = current_user.personal_access_tokens.build + set_index_vars end def create @@ -12,7 +10,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController flash[:personal_access_token] = @personal_access_token.token redirect_to profile_personal_access_tokens_path, notice: "Your new personal access token has been created." else - load_personal_access_tokens + set_index_vars render :index end end @@ -32,10 +30,12 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController private def personal_access_token_params - params.require(:personal_access_token).permit(:name, :expires_at) + params.require(:personal_access_token).permit(:name, :expires_at, scopes: []) end - def load_personal_access_tokens + def set_index_vars + @personal_access_token ||= current_user.personal_access_tokens.build + @scopes = Gitlab::Auth::SCOPES @active_personal_access_tokens = current_user.personal_access_tokens.active.order(:expires_at) @inactive_personal_access_tokens = current_user.personal_access_tokens.inactive end |