Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
07d37084
Commit
07d37084
authored
Aug 28, 2015
by
David Monllaó
Browse files
MDL-42639 user: user:viewalldetails enough to view some fields
The fields are: - username - idnumber - institution - department
parent
fd57d685
Changes
1
Hide whitespace changes
Inline
Side-by-side
user/lib.php
View file @
07d37084
...
...
@@ -310,8 +310,10 @@ function user_get_user_details($user, $course = null, array $userfields = array(
$userdetails
=
array
();
$userdetails
[
'id'
]
=
$user
->
id
;
if
((
$isadmin
or
$currentuser
)
and
in_array
(
'username'
,
$userfields
))
{
$userdetails
[
'username'
]
=
$user
->
username
;
if
(
in_array
(
'username'
,
$userfields
))
{
if
(
$currentuser
or
has_capability
(
'moodle/user:viewalldetails'
,
$context
))
{
$userdetails
[
'username'
]
=
$user
->
username
;
}
}
if
(
$isadmin
or
$canviewfullnames
)
{
if
(
in_array
(
'firstname'
,
$userfields
))
{
...
...
@@ -465,18 +467,22 @@ function user_get_user_details($user, $course = null, array $userfields = array(
}
// Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
if
(
$isadmin
or
$currentuser
or
in_array
(
'idnumber'
,
$showuseridentityfields
))
{
if
(
in_array
(
'idnumber'
,
$userfields
)
&&
$user
->
idnumber
)
{
if
(
in_array
(
'idnumber'
,
$userfields
)
&&
$user
->
idnumber
)
{
if
(
in_array
(
'idnumber'
,
$showuseridentityfields
)
or
$currentuser
or
has_capability
(
'moodle/user:viewalldetails'
,
$context
))
{
$userdetails
[
'idnumber'
]
=
$user
->
idnumber
;
}
}
if
(
$isadmin
or
$currentuser
or
in_array
(
'institution'
,
$showuseridentityfields
))
{
if
(
in_array
(
'institution'
,
$userfields
)
&&
$user
->
institution
)
{
if
(
in_array
(
'institution'
,
$userfields
)
&&
$user
->
institution
)
{
if
(
in_array
(
'institution'
,
$showuseridentityfields
)
or
$currentuser
or
has_capability
(
'moodle/user:viewalldetails'
,
$context
))
{
$userdetails
[
'institution'
]
=
$user
->
institution
;
}
}
if
(
$isadmin
or
$currentuser
or
in_array
(
'department'
,
$showuseridentityfields
))
{
if
(
in_array
(
'department'
,
$userfields
)
&&
isset
(
$user
->
department
))
{
// Isset because it's ok to have department 0.
// Isset because it's ok to have department 0.
if
(
in_array
(
'department'
,
$userfields
)
&&
isset
(
$user
->
department
))
{
if
(
in_array
(
'department'
,
$showuseridentityfields
)
or
$currentuser
or
has_capability
(
'moodle/user:viewalldetails'
,
$context
))
{
$userdetails
[
'department'
]
=
$user
->
department
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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