Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b05f0a48
Commit
b05f0a48
authored
Mar 24, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict user profiles based on restricted visibility levels
parent
5ae4fd21
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+4
-0
app/models/user.rb
app/models/user.rb
+4
-0
No files found.
app/controllers/users_controller.rb
View file @
b05f0a48
class
UsersController
<
ApplicationController
class
UsersController
<
ApplicationController
skip_before_action
:authenticate_user!
skip_before_action
:authenticate_user!
before_action
:set_user
before_action
:set_user
before_filter
:authorize_read_user
,
only:
[
:show
]
def
show
def
show
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -74,6 +75,9 @@ class UsersController < ApplicationController
...
@@ -74,6 +75,9 @@ class UsersController < ApplicationController
end
end
private
private
def
authorize_read_user
render_404
unless
@user
.
public?
end
def
set_user
def
set_user
@user
=
User
.
find_by_username!
(
params
[
:username
])
@user
=
User
.
find_by_username!
(
params
[
:username
])
...
...
app/models/user.rb
View file @
b05f0a48
...
@@ -835,6 +835,10 @@ class User < ActiveRecord::Base
...
@@ -835,6 +835,10 @@ class User < ActiveRecord::Base
notification_settings
.
find_or_initialize_by
(
source:
source
)
notification_settings
.
find_or_initialize_by
(
source:
source
)
end
end
def
public?
current_application_settings
.
restricted_visibility_levels
.
include?
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
private
private
def
projects_union
def
projects_union
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment