$c->stash->{'permission'} = 'full'
if( $user->is_admin || $tradition->user->id eq $user->id );
return 1;
- } elsif( $tradition->public ) {
+ }
+ # Is it public?
+ if( $tradition->public ) {
$c->stash->{'permission'} = 'readonly';
return 1;
- } else {
- # Forbidden!
- $c->response->status( 403 );
- $c->response->body( 'You do not have permission to view this tradition.' );
- $c->detach( 'View::Plain' );
- return 0;
- }
+ }
+ # Forbidden!
+ $c->response->status( 403 );
+ $c->response->body( 'You do not have permission to view this tradition.' );
+ $c->detach( 'View::Plain' );
+ return 0;
}
sub _clean_booleans {
if( $user ) {
return 'full' if ( $user->is_admin ||
( $tradition->has_user && $tradition->user->id eq $user->id ) );
- } elsif( $tradition->public ) {
- return 'readonly';
- }
- # else Forbidden!
+ }
+ # Text doesn't belong to us, so maybe it's public?
+ return 'readonly' if $tradition->public;
+
+ # ...nope. Forbidden!
$c->response->status( 403 );
$c->response->body( 'You do not have permission to view this tradition.' );
$c->detach( 'View::Plain' );
$c->stash->{'permission'} = 'full'
if( $user->is_admin || $tradition->user->id eq $user->id );
return 1;
- } elsif( $tradition->public ) {
+ }
+ # Is it public?
+ if( $tradition->public ) {
$c->stash->{'permission'} = 'readonly';
return 1;
- } else {
- # Forbidden!
- $c->response->status( 403 );
- $c->response->body( 'You do not have permission to view this tradition.' );
- $c->detach( 'View::Plain' );
- return 0;
- }
+ }
+ # Forbidden!
+ $c->response->status( 403 );
+ $c->response->body( 'You do not have permission to view this tradition.' );
+ $c->detach( 'View::Plain' );
+ return 0;
}
=head2 graphsvg