You are here

function CourseObjectNode::grant in Course 7

Same name and namespace in other branches
  1. 6 includes/course_object.core.inc \CourseObjectNode::grant()

Grant access to course content before going to it.

Overrides CourseObject::grant

File

includes/CourseObjectNode.inc, line 294

Class

CourseObjectNode
A course object that uses a node as a base.

Code

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