Skip to content

Commit

Permalink
MDL-58220 auth_oauth2: Linked logins only 4U
Browse files Browse the repository at this point in the history
You can only manage your own linked logins - never anyone elses.
  • Loading branch information
Damyon Wiese committed Apr 6, 2017
1 parent 427fa27 commit 340659c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion auth/oauth2/lib.php
Expand Up @@ -38,9 +38,10 @@ function auth_oauth2_extend_navigation_user_settings(navigation_node $useraccoun
context_user $context,
stdClass $course,
context_course $coursecontext) {
global $USER;

if (!\core\session\manager::is_loggedinas()) {
if (has_capability('auth/oauth2:managelinkedlogins', $context)) {
if (has_capability('auth/oauth2:managelinkedlogins', $context) && $user->id == $USER->id) {

$parent = $useraccount->parent->find('useraccount', navigation_node::TYPE_CONTAINER);
$parent->add(get_string('linkedlogins', 'auth_oauth2'), new moodle_url('/auth/oauth2/linkedlogins.php'));
Expand Down

0 comments on commit 340659c

Please sign in to comment.