Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
192977f6
Commit
192977f6
authored
Oct 03, 2013
by
Son Nguyen
Committed by
Gerrit Code Review
Oct 03, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "For private profiles, hide all profile information from logged-out users" into 1.6_STABLE
parents
e5764a51
6490dda9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
htdocs/user/view.php
htdocs/user/view.php
+20
-2
No files found.
htdocs/user/view.php
View file @
192977f6
...
...
@@ -48,7 +48,13 @@ $loggedinid = $USER->get('id');
if
(
$profileurlid
=
param_alphanumext
(
'profile'
,
null
))
{
if
(
!
$user
=
get_record
(
'usr'
,
'urlid'
,
$profileurlid
,
'deleted'
,
0
))
{
throw
new
UserNotFoundException
(
"User
$profileurlid
not found"
);
if
(
$USER
->
is_logged_in
())
{
throw
new
UserNotFoundException
(
"User
$profileurlid
not found"
);
}
else
{
// For logged-out users we show "access denied" in order to prevent an enumeration attack
throw
new
AccessDeniedException
(
get_string
(
'youcannotviewthisusersprofile'
,
'error'
));
}
}
$userid
=
$user
->
id
;
}
...
...
@@ -65,7 +71,13 @@ if ($userid == 0) {
// Get the user's details
if
(
!
isset
(
$user
))
{
if
(
!
$user
=
get_record
(
'usr'
,
'id'
,
$userid
,
'deleted'
,
0
))
{
throw
new
UserNotFoundException
(
"User with id
$userid
not found"
);
if
(
$USER
->
is_logged_in
())
{
throw
new
UserNotFoundException
(
"User with id
$userid
not found"
);
}
else
{
// For logged-out users we show "access denied" in order to prevent an enumeration attack
throw
new
AccessDeniedException
(
get_string
(
'youcannotviewthisusersprofile'
,
'error'
));
}
}
}
$is_friend
=
is_friend
(
$userid
,
$loggedinid
);
...
...
@@ -86,7 +98,13 @@ if (!$view) {
}
$viewid
=
$view
->
get
(
'id'
);
// Special behaviour: Logged in users who the page hasn't been shared with, see a special page
// with the user's name, icon, and little else.
$restrictedview
=
!
can_view_view
(
$viewid
);
// Logged-out users can't see any details, though
if
(
$restrictedview
&&
!
$USER
->
is_logged_in
())
{
throw
new
AccessDeniedException
(
get_string
(
'accessdenied'
,
'error'
));
}
if
(
!
$restrictedview
)
{
$viewcontent
=
$view
->
build_columns
();
}
...
...
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