CourseObjectNodeFulfillment.inc in Course 7.2
File
includes/CourseObjectNodeFulfillment.inc
View source
<?php
class CourseObjectNodeFulfillment extends CourseObjectFulfillment {
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);
}
}
}
function revoke() {
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_remove_user($acl_id, $this->uid);
node_access_acquire_grants($node);
}
}
}
function delete() {
$this
->revoke();
parent::delete();
}
}