Skip to content

Commit f5bfc98

Browse files
authored
Only touch ACLs managed by Stud.IP plugin (#1054)
Some time ago, Till told me the Stud.IP Opencast plugin would only manage episode's ACLs relevant to Stud.IP where in fact, the plugin would remove ACLs from events granting permissions in secondary LMSes or other uses. This approach checks if an existing Opencast ACL is managed by Stud.IP (hex_Learner/hex_Instructor/ ROLE_ADMIN/ROLE_ANONYMOUS), and if not, it would add those again to the list of ACLs and check again, if the list of ACLs sent by Opencast differs from the list of ACLs to be set.
1 parent ffc7ea9 commit f5bfc98

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

classes/lti/OpencastLTI.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,17 @@ public static function apply_acl_to_courses($acl, $courses, $target_id, $target_
352352

353353
// check, if the calculated and actual acls differ and update if so
354354
if ($oc_acl <> $acl->toArray()) {
355-
$client->setACL($target_id, $acl);
355+
// To only touch ACLs set by the Stud.IP plugin,
356+
// copy over existing ACLs which aren't handled by Stud.IP.
357+
foreach ($oc_acl as $oc_acl_entry) {
358+
if (!preg_match('~(?:[0-9a-f]{32}_(?:Instructor|Learner)|ROLE_ANONYMOUS|ROLE_ADMIN)~', $oc_acl_entry['role'])) {
359+
$e = new \AccessControlEntity($oc_acl_entry['role'], $oc_acl_entry['action'], $oc_acl_entry['allow']);
360+
$acl->add_ace($e);
361+
}
362+
}
363+
if ($oc_acl <> $acl->toArray()) {
364+
$client->setACL($target_id, $acl);
365+
}
356366
}
357367
}
358368

0 commit comments

Comments
 (0)