Capability: local/mail:usemail to allow/deny access to mail
Discard drafts is allowed to users not enrolled in a course but have access to the course
Replaced deprecated function get_context_instance