You are here

function CourseObjectNodeFulfillment::grant in Course 7.2

Grant access to course content before going to it.

Overrides CourseObjectFulfillment::grant

File

includes/CourseObjectNodeFulfillment.inc, line 14

Class

CourseObjectNodeFulfillment
Course object node fulfillment.

Code

function grant() {
  if ($this
    ->getCourseObject()
    ->hasNodePrivacySupport()) {
    if ($this
      ->getCourseObject()
      ->getOption('private')) {
      $node = $this
        ->getCourseObject()
        ->getNode();
      module_load_include('inc', 'content_access', 'content_access.admin');
      $acl_id = content_access_get_acl_id($node, 'view');
      acl_add_user($acl_id, $this->uid);
      acl_node_add_acl($node->nid, $acl_id, 1, 0, 0, content_access_get_settings('priority', $node->type));
      node_access_acquire_grants($node);
    }
  }
}