Skip to content

Commit

Permalink
[FIX] Undefined array key "operation" when creating series opencast-i…
Browse files Browse the repository at this point in the history
  • Loading branch information
chfsx committed Jul 23, 2024
1 parent 4abcfe7 commit 060fbd1
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions classes/class.ilObjOpenCastAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ public static function checkAction(
): bool {
global $DIC;

if (!$user instanceof \srag\Plugins\Opencast\Model\User\xoctUser) {
$user = xoctUser::getInstance($DIC->user());
}

Expand All @@ -192,45 +191,29 @@ public static function checkAction(
case self::ACTION_EDIT_OWNER:
return
self::hasPermission(self::PERMISSION_EDIT_VIDEOS, $ref_id)
&& $event->getProcessingState() != Event::STATE_ENCODING
&& ilObjOpenCast::_getParentCourseOrGroup($ref_id)
&& $objectSettings->getPermissionPerClip();
case self::ACTION_SHARE_EVENT:
return
(self::hasPermission(
self::PERMISSION_EDIT_VIDEOS,
$ref_id
) && $objectSettings->getPermissionPerClip())
|| ($opencastDIC->acl_utils()->isUserOwnerOfEvent($user, $event)
&& $objectSettings->getPermissionAllowSetOwn()
&& $event->getProcessingState() != Event::STATE_ENCODING
&& $event->getProcessingState() != Event::STATE_FAILED);
case self::ACTION_CUT:
return
self::hasPermission(self::PERMISSION_EDIT_VIDEOS, $ref_id)
&& $event->hasPreviews()
&& $event->getProcessingState() != Event::STATE_FAILED;
case self::ACTION_DELETE_EVENT:
return
(self::hasPermission(self::PERMISSION_EDIT_VIDEOS)
|| ((self::hasPermission(self::PERMISSION_UPLOAD) || self::hasPermission(self::PERMISSION_RECORD))
&& $opencastDIC->acl_utils()->isUserOwnerOfEvent($user, $event)))
&& $event->getProcessingState() != Event::STATE_ENCODING;
case self::ACTION_EDIT_EVENT:
return
(self::hasPermission(self::PERMISSION_EDIT_VIDEOS)
|| ((self::hasPermission(self::PERMISSION_UPLOAD) || self::hasPermission(self::PERMISSION_RECORD))
&& $opencastDIC->acl_utils()->isUserOwnerOfEvent($user, $event)))
&& $event->getProcessingState() != Event::STATE_ENCODING
&& $event->getProcessingState() != Event::STATE_FAILED
&& (!$event->isScheduled() || PluginConfig::getConfig(
PluginConfig::F_SCHEDULED_METADATA_EDITABLE
) != PluginConfig::NO_METADATA);
case self::ACTION_SET_ONLINE_OFFLINE:
return
self::hasPermission(self::PERMISSION_EDIT_VIDEOS)
&& $event->getProcessingState() != Event::STATE_ENCODING
&& $event->getProcessingState() != Event::STATE_FAILED;
case self::ACTION_ADD_EVENT:
return
self::hasPermission(self::PERMISSION_UPLOAD);
Expand Down Expand Up @@ -259,7 +242,6 @@ public static function checkAction(
|| (/* (self::hasPermission(self::PERMISSION_DOWNLOAD) || self::hasPermission(self::PERMISSION_UPLOAD)) && */
$opencastDIC->acl_utils()->isUserOwnerOfEvent($user, $event)
))
&& $event->getProcessingState() == Event::STATE_SUCCEEDED;
case self::ACTION_SCHEDULE_EVENT:
return
self::hasPermission(self::PERMISSION_SCHEDULE);
Expand Down Expand Up @@ -375,7 +357,7 @@ public static function isActionAllowedForRole(string $action, string $role, ?int
{
global $DIC;
$ref_id = $ref_id ?? (int) ($DIC->http()->request()->getQueryParams()['ref_id'] ?? 0);
$prefix = in_array($action, self::$custom_rights) ? "rep_robj_xoct_perm_" : "";
$prefix = in_array($action, self::$custom_rights, true) ? "rep_robj_xoct_perm_" : "";
if (!$parent_obj = ilObjOpenCast::_getParentCourseOrGroup($ref_id)) {
return false;
}
Expand All @@ -386,7 +368,7 @@ public static function isActionAllowedForRole(string $action, string $role, ?int
);
foreach ($active_operations as $op_id) {
$operation = $DIC->rbac()->review()->getOperation($op_id);
if ($operation['operation'] == $prefix . $action) {
if (($operation['operation'] ?? null) === $prefix . $action) {
return true;
}
}
Expand Down

0 comments on commit 060fbd1

Please sign in to comment.