from courseware.access import has_access
from django.conf import settings


def is_certificate_allowed(user, course):
    return (course.has_ended()
            and settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE')
            or has_access(user, 'staff', course.id))

from courseware.access import has_access
from django.conf import settings


def is_certificate_allowed(user, course):
    if not settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE'):
        return False

    return course.has_ended() or has_access(user, 'staff', course.id)

Disable certificate for all if ENABLE_ISSUE_CERTIFICATE == False
Disable certificate for all if ENABLE_ISSUE_CERTIFICATE == False

  from courseware.access import has_access
  from django.conf import settings
  
  
  def is_certificate_allowed(user, course):
-     return (course.has_ended()
-             and settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE')
+     if not settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE'):
-             or has_access(user, 'staff', course.id))
+         return False
  
+     return course.has_ended() or has_access(user, 'staff', course.id)
+ 
Disable certificate for all if ENABLE_ISSUE_CERTIFICATE == False
## Code Before:
from courseware.access import has_access
from django.conf import settings


def is_certificate_allowed(user, course):
    return (course.has_ended()
            and settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE')
            or has_access(user, 'staff', course.id))

## Instruction:
Disable certificate for all if ENABLE_ISSUE_CERTIFICATE == False
## Code After:
from courseware.access import has_access
from django.conf import settings


def is_certificate_allowed(user, course):
    if not settings.FEATURES.get('ENABLE_ISSUE_CERTIFICATE'):
        return False

    return course.has_ended() or has_access(user, 'staff', course.id)
