Skip to content

Commit 66b3ab1

Browse files
committed
fixed: questions owners should not be able to edit answers
1 parent b31415b commit 66b3ab1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

classes/ColdTrick/Questions/Permissions.php

+8
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public static function objectPermissionsCheck(\Elgg\Event $event): ?bool {
7171

7272
/* @var $returnvalue bool */
7373
$returnvalue = $event->getValue();
74+
if ($entity instanceof \ElggAnswer) {
75+
$container = $entity->getContainerEntity()?->getContainerEntity();
76+
77+
// use default access for group editors to moderate answers otherwise only allow for owners
78+
if (!$container instanceof \ElggGroup || !$container->canEdit($user->guid)) {
79+
$returnvalue = $entity->owner_guid === $user->guid;
80+
}
81+
}
7482

7583
// expert only changes
7684
if (questions_experts_enabled()) {

0 commit comments

Comments
 (0)