fixes to the Gallery

This commit is contained in:
Doug Bell 2007-12-18 21:17:44 +00:00
parent 99274cd4ee
commit 53a1cbc7c2
8 changed files with 72 additions and 27 deletions

View file

@ -447,18 +447,31 @@ check. If no userId is passed, will check the current user.
Users can edit this gallery if they are part of the C<groupIdEdit> group.
Also checks if a user is adding a GalleryAlbum and allows them to if they are
part of the C<groupIdAddFile> group.
=cut
sub canEdit {
my $self = shift;
my $userId = shift;
my $user = $userId
? WebGUI::User->new( $self->session, $userId )
: $self->session->user
;
my $form = $self->session->form;
return $user->isInGroup( $self->get("groupIdEdit") );
if ( $form->get('func') eq "add" ) {
return $self->canAddFile( $userId );
}
elsif ( $form->get('func') eq "editSave" && $form->get('assetId') eq "new" ) {
return $self->canAddFile( $userId );
}
else {
my $user = $userId
? WebGUI::User->new( $self->session, $userId )
: $self->session->user
;
return $user->isInGroup( $self->get("groupIdEdit") );
}
}
#----------------------------------------------------------------------------