Don't update storage permissions if there isn't an "old" argument. This was being called during ->new.
This commit is contained in:
parent
645abf51d1
commit
dbac3e2ae7
1 changed files with 7 additions and 4 deletions
|
|
@ -21,7 +21,8 @@ Package WebGUI::Role::Asset::SetStoragePermissions
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Provide methods for the triggers on ownerUserId, groupIdEdit and groupIdView that update
|
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
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
|
@ -31,9 +32,11 @@ with WebGUI::Role::Asset::SetStoragePermissions;
|
||||||
|
|
||||||
use Moose::Role;
|
use Moose::Role;
|
||||||
|
|
||||||
|
requires qw/getStorageLocation/;
|
||||||
|
|
||||||
sub _set_ownerUserId {
|
sub _set_ownerUserId {
|
||||||
my ($self, $new, $old) = @_;
|
my ($self, $new, $old) = @_;
|
||||||
$old ||= '';
|
return unless $old;
|
||||||
if ($new ne $old) {
|
if ($new ne $old) {
|
||||||
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +44,7 @@ sub _set_ownerUserId {
|
||||||
|
|
||||||
sub _set_groupIdView {
|
sub _set_groupIdView {
|
||||||
my ($self, $new, $old) = @_;
|
my ($self, $new, $old) = @_;
|
||||||
$old ||= '';
|
return unless $old;
|
||||||
if ($new ne $old) {
|
if ($new ne $old) {
|
||||||
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +52,7 @@ sub _set_groupIdView {
|
||||||
|
|
||||||
sub _set_groupIdEdit {
|
sub _set_groupIdEdit {
|
||||||
my ($self, $new, $old) = @_;
|
my ($self, $new, $old) = @_;
|
||||||
$old ||= '';
|
return unless $old;
|
||||||
if ($new ne $old) {
|
if ($new ne $old) {
|
||||||
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
$self->getStorageLocation->setPrivileges($self->ownerUserId, $self->groupIdView, $self->groupIdEdit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue