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
16164964
Commit
16164964
authored
Sep 30, 2015
by
David Monllaó
Browse files
Merge branch 'MDL-51415-master' of
git://github.com/jleyva/moodle
parents
7f64df41
48a90a21
Changes
3
Hide whitespace changes
Inline
Side-by-side
group/externallib.php
View file @
16164964
...
...
@@ -1363,13 +1363,14 @@ class core_group_external extends external_api {
}
// Validate if the user is enrolled in the course.
if
(
!
is_enrolled
(
$coursecontext
,
$user
->
id
))
{
$course
=
get_course
(
$cm
->
course
);
if
(
!
can_access_course
(
$course
,
$user
,
''
,
true
))
{
// We return a warning because the function does not fail for not enrolled users.
$warning
=
array
();
$warning
[
'item'
]
=
'course'
;
$warning
[
'itemid'
]
=
$cm
->
course
;
$warning
[
'warningcode'
]
=
'1'
;
$warning
[
'message'
]
=
"User
$user->id
is
not
enrolled in
course
$cm->course
"
;
$warning
[
'message'
]
=
"User
$user->id
can
not
access
course
$cm->course
"
;
$warnings
[]
=
$warning
;
}
}
...
...
notes/externallib.php
View file @
16164964
...
...
@@ -690,7 +690,7 @@ class core_notes_external extends external_api {
throw
new
moodle_exception
(
'invaliduserid'
);
}
if
(
$course
->
id
!=
SITEID
and
!
is_enrolled
(
$context
,
$user
,
''
,
true
))
{
if
(
$course
->
id
!=
SITEID
and
!
can_access_course
(
$course
,
$user
,
''
,
true
))
{
throw
new
moodle_exception
(
'notenrolledprofile'
);
}
}
...
...
user/externallib.php
View file @
16164964
...
...
@@ -1419,7 +1419,7 @@ class core_user_external extends external_api {
profile_view
(
$user
,
$usercontext
);
}
else
{
// Case like user/view.php.
if
(
!
$currentuser
and
!
is_enrolled
(
$coursecontext
,
$user
->
id
))
{
if
(
!
$currentuser
and
!
can_access_course
(
$course
,
$user
,
''
,
true
))
{
throw
new
moodle_exception
(
'notenrolledprofile'
);
}
...
...
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