diff options
author | JX Terry <jxterry@protonmail.com> | 2018-07-24 15:46:19 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-24 15:46:19 +0300 |
commit | 99011a61cf4136c806e7de43fcd55475d2407fa1 (patch) | |
tree | 99486b31dc0df1b86db0bb11ec32b05c9bc1fb2d /app/controllers/users_controller.rb | |
parent | adc327d3fa72b9f5b9c42c629c99f0a89ca15192 (diff) |
Add an option to have a private profile on GitLab
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 31f47a7aa7c..2f65f4a7403 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,6 +13,8 @@ class UsersController < ApplicationController skip_before_action :authenticate_user! before_action :user, except: [:exists] + before_action :authorize_read_user_profile!, + only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :snippets] def show respond_to do |format| @@ -148,4 +150,8 @@ class UsersController < ApplicationController def build_canonical_path(user) url_for(safe_params.merge(username: user.to_param)) end + + def authorize_read_user_profile! + access_denied! unless can?(current_user, :read_user_profile, user) + end end |