From e0eaa2e13f653bfdafa2dee413ffee5319773eaf Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 23 Aug 2010 11:48:57 -0700 Subject: [PATCH] Fix group permissions when editing/adding an Event. Fixes bug #11800. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Event.pm | 10 +++++++--- t/Asset/Event/edit.t | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index a418231d5..897049487 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,7 @@ - fixed #11785: Article title / URL with äÄöÖüÜ (reopen #11683) - fixed #11799: 7.8.24->7.9.11 upgrade breaks on custom Paydrivers - fixed #11798: Gallery request non existent image + - fixed #11800: Group to view for new events defaults to 'Everyone' 7.9.12 - webgui.org homepage gives 404 (#11778) diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 1c929b1b6..10b3b1c58 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -1345,10 +1345,14 @@ sub processPropertiesFromFormPost { WebGUI::VersionTag->new($session, $self->get('tagId'))->setWorking; } - ### Form is verified - # Events are always hidden from navigation + ### Form is verified, fix properties + if (!$session->form->hasParam('groupIdView')) { + $self->update({ + groupIdView => $self->getParent->get('groupIdView'), + }); + } - if (!$self->get("groupIdEdit")) { + if (!$session->form->hasParam('groupIdEdit')) { my $groupIdEdit = $self->getParent->get("groupIdEventEdit") || $self->getParent->get("groupIdEdit") ; diff --git a/t/Asset/Event/edit.t b/t/Asset/Event/edit.t index 9b9381019..3cb86bb38 100644 --- a/t/Asset/Event/edit.t +++ b/t/Asset/Event/edit.t @@ -118,6 +118,7 @@ $properties = { %{ $properties }, ownerUserId => $user->userId, createdBy => $user->userId, + groupIdEdit => '2', }; cmp_deeply( $event->get, superhashof( $properties ), 'Event properties saved correctly' ); @@ -164,6 +165,7 @@ $properties = { %{ $properties }, ownerUserId => $user->userId, createdBy => $user->userId, + groupIdEdit => '2', }; cmp_deeply( $event->get, superhashof( $properties ), 'Events properties saved correctly' );