WikiPage attachments need groupToEdit to be the same as the ancestor wiki groupToEditPage, otherwise users's cannot edit their own attachments. Fixes bug #11057
Also, update the test to use addToCleanup.
This commit is contained in:
parent
c2fde74448
commit
4b8ab2a039
4 changed files with 48 additions and 30 deletions
|
|
@ -12,6 +12,7 @@
|
|||
- fixed #11112: story archive RSS feed
|
||||
- added Insurance estimator for the USPS shipping driver
|
||||
- fixed #11121: Syndicated Content search terms require both title and description match
|
||||
- fixed #11057: Deleting wiki attachments
|
||||
|
||||
7.8.1
|
||||
- mark $session->datetime->time as deprecated and remove its use from core code
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ my $quiet; # this line required
|
|||
my $session = start(); # this line required
|
||||
|
||||
fixTableDefaultCharsets($session);
|
||||
correctWikiAttachmentPermissions( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -76,6 +77,28 @@ sub fixTableDefaultCharsets {
|
|||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub correctWikiAttachmentPermissions {
|
||||
my $session = shift;
|
||||
print "\tCorrect group edit permission on wiki page attachments... " unless $quiet;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $pageIterator = $root->getLineageIterator(
|
||||
['descendants'],
|
||||
{
|
||||
includeOnlyClasses => ['WebGUI::Asset::WikiPage'],
|
||||
}
|
||||
);
|
||||
PAGE: while (my $wikiPage = $pageIterator->()) {
|
||||
my $wiki = $wikiPage->getWiki;
|
||||
next PAGE unless $wiki && $wiki->get('allowAttachments') && $wikiPage->getChildCount;
|
||||
foreach my $attachment (@{ $wikiPage->getLineage(['children'])}) {
|
||||
$attachment->update({ groupIdEdit => $wiki->get('groupToEditPages') });
|
||||
}
|
||||
}
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue