diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-09-10 17:54:09 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-09-10 17:54:09 +0300 |
commit | 6db2843bc2e662f785625eb8aff6803c3e2786f8 (patch) | |
tree | 42d15e58b436931a6e7c19ab0427f08ebd882305 /app/controllers/ci | |
parent | f5af4efabd410f6140fb0ac16f7787bb2a5b457f (diff) | |
download | gitlab-ce-6db2843bc2e662f785625eb8aff6803c3e2786f8.tar.gz |
fix of project creation
Diffstat (limited to 'app/controllers/ci')
-rw-r--r-- | app/controllers/ci/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/ci/user_sessions_controller.rb | 55 |
2 files changed, 1 insertions, 56 deletions
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 80a5e602171..c30c5d9590b 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -55,7 +55,7 @@ module Ci def create project_data = OpenStruct.new(JSON.parse(params["project"])) - unless can?(current_user, :manage_project, ::Project.find(project_data.id)) + unless can?(current_user, :admin_project, ::Project.find(project_data.id)) return redirect_to ci_root_path, alert: 'You have to have at least master role to enable CI for this project' end diff --git a/app/controllers/ci/user_sessions_controller.rb b/app/controllers/ci/user_sessions_controller.rb deleted file mode 100644 index 818e1fcdea1..00000000000 --- a/app/controllers/ci/user_sessions_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Ci - class UserSessionsController < Ci::ApplicationController - before_filter :authenticate_user!, except: [:new, :callback, :auth] - - def show - @user = current_user - end - - def new - end - - def auth - redirect_to client.auth_code.authorize_url({ - redirect_uri: callback_ci_user_sessions_url, - state: params[:state] - }) - end - - def callback - token = client.auth_code.get_token(params[:code], redirect_uri: callback_ci_user_sessions_url).token - - @user_session = Ci::UserSession.new - user = @user_session.authenticate(access_token: token) - - if user && sign_in(user) - return_to = get_ouath_state_return_to(params[:state]) - redirect_to(return_to || ci_root_path) - else - @error = 'Invalid credentials' - render :new - end - - end - - def destroy - sign_out - - redirect_to new_ci_user_sessions_path - end - - protected - - def client - @client ||= ::OAuth2::Client.new( - GitlabCi.config.gitlab_server.app_id, - GitlabCi.config.gitlab_server.app_secret, - { - site: GitlabCi.config.gitlab_server.url, - authorize_url: 'oauth/authorize', - token_url: 'oauth/token' - } - ) - end - end -end |