Skip to content

Commit

Permalink
Fix incorrect playlist acl check (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis531 authored and tgloeggl committed Nov 25, 2024
1 parent c308c9f commit 2a54fc5
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions lib/Models/Playlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,32 +406,8 @@ public static function checkPlaylistACL($oc_playlist, $playlist)

$old_acls = Helpers::filterACLs($old_acl, $acl);

$current_acl = $old_acls['studip'];

foreach ($acl as $entry) {
$found = false;
foreach ($current_acl as $current_key => &$current_entry) {
if ($current_entry['role'] === $entry['role'] && $current_entry['action'] === $entry['action']) {
if ($found) {
// Remove duplicates
unset($current_acl[$current_key]);
continue;
}

$found = true;

// Ensure that allowed is true
$current_entry['allow'] = $entry['allow'];
}
}

if (!$found) {
$current_acl[$entry['role'] . '_'. $entry['action']] = $entry;
}
}

// Reindex keys
$current_acl = array_values($current_acl);
$current_acl = array_values($old_acls['studip']);

sort($current_acl);
sort($acl);
Expand Down

0 comments on commit 2a54fc5

Please sign in to comment.