MDL-58220 auth_oauth2: Linked logins only 4U

You can only manage your own linked logins - never anyone elses.
This commit is contained in:
Damyon Wiese 2017-04-06 16:06:12 +08:00
parent 427fa27cf4
commit 340659cc29

View File

@ -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'));