public static function revoke_acceptance($policyversionid, $userid, $note = null) {
        global $DB, $USER;
        if (!$userid) {
            $userid = $USER->id;
        }
        self::can_accept_policies([$policyversionid], $userid, true);

        if ($currentacceptance = $DB->get_record('tool_policy_acceptances',
                ['policyversionid' => $policyversionid, 'userid' => $userid])) {
            $realuser = manager::get_realuser();
            $updatedata = ['id' => $currentacceptance->id, 'status' => 0, 'timemodified' => time(),
                'usermodified' => $realuser->id, 'note' => $note];
            $DB->update_record('tool_policy_acceptances', $updatedata);
            acceptance_updated::create_from_record((object)($updatedata + (array)$currentacceptance))->trigger();
        }

        static::update_policyagreed($userid);
    }