From dbac3e2ae700b73067cb879a3448d745b950e3a5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 19 Aug 2010 11:44:20 -0700 Subject: [PATCH] Don't update storage permissions if there isn't an "old" argument. This was being called during ->new. --- lib/WebGUI/Role/Asset/SetStoragePermissions.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Role/Asset/SetStoragePermissions.pm b/lib/WebGUI/Role/Asset/SetStoragePermissions.pm index fdcf3ebcb..c24abda73 100644 --- a/lib/WebGUI/Role/Asset/SetStoragePermissions.pm +++ b/lib/WebGUI/Role/Asset/SetStoragePermissions.pm @@ -21,7 +21,8 @@ Package WebGUI::Role::Asset::SetStoragePermissions =head1 DESCRIPTION Provide methods for the triggers on ownerUserId, groupIdEdit and groupIdView that update -the file permissions on storage locations for an Asset. +the file permissions on storage locations for an Asset. Consumers of SetStoragePermissions +must have a getStorageLocation method, so that it can find the storage location. =head1 SYNOPSIS @@ -31,9 +32,11 @@ with WebGUI::Role::Asset::SetStoragePermissions; use Moose::Role; +requires qw/getStorageLocation/; + sub _set_ownerUserId { my ($self, $new, $old) = @_; - $old ||= ''; + return unless $old; if ($new ne $old) { $self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit); } @@ -41,7 +44,7 @@ sub _set_ownerUserId { sub _set_groupIdView { my ($self, $new, $old) = @_; - $old ||= ''; + return unless $old; if ($new ne $old) { $self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit); } @@ -49,7 +52,7 @@ sub _set_groupIdView { sub _set_groupIdEdit { my ($self, $new, $old) = @_; - $old ||= ''; + return unless $old; if ($new ne $old) { $self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit); }