public static function delete_linked_login($linkedloginid) {
        $login = new linked_login($linkedloginid);
        $userid = $login->get('userid');

        if (\core\session\manager::is_loggedinas()) {
            throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
        }

        $context = context_user::instance($userid);
        require_capability('auth/oauth2:managelinkedlogins', $context);

        $login->delete();
    }
public static function delete_linked_login($linkedloginid) {
        $login = new linked_login($linkedloginid);
        $userid = $login->get('userid');

        if (\core\session\manager::is_loggedinas()) {
            throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
        }

        $context = context_user::instance($userid);
        require_capability('auth/oauth2:managelinkedlogins', $context);

        $login->delete();
    }
public static function delete_linked_login ( $ linkedloginid ) { $ login = new linked_login ( $ linkedloginid ) ; $ userid = $ login -> get ( 'userid' ) ; if ( \ core \ session \ manager :: is_loggedinas ( ) ) { throw new moodle_exception ( 'notwhileloggedinas' , 'auth_oauth2' ) ; } $ context = context_user :: instance ( $ userid ) ; require_capability ( 'auth/oauth2:managelinkedlogins' , $ context ) ; $ login -> delete ( ) ; }
Delete linked login

Requires auth/oauth2:managelinkedlogins capability at the user context.

@param int $linkedloginid
@return boolean
Delete linked login