function CourseObjectNode::grant in Course 6
Same name and namespace in other branches
- 7 includes/CourseObjectNode.inc \CourseObjectNode::grant()
Grant access to course content before going to it.
Overrides CourseObject::grant
File
- includes/
course_object.core.inc, line 1248
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_save($this->node);
}
}
}