fix logic bug for admin textinfo edit
tla [Tue, 4 Sep 2012 09:40:36 +0000 (11:40 +0200)]
lib/stemmaweb/Controller/Root.pm

index 9d18c67..d4184aa 100644 (file)
@@ -223,7 +223,8 @@ sub textinfo :Local :Args(1) {
                if( exists $params->{'owner'} ) {
                        # Only admins can update user / owner
                        my $newownerid = delete $params->{'owner'};
-                       unless( $tradition->has_user && $tradition->user->id eq $newownerid ) {
+                       unless( !$newownerid || 
+                               ( $tradition->has_user && $tradition->user->id eq $newownerid ) ) {
                                unless( $c->user->get_object->is_admin ) {
                                        return _json_error( $c, 403, 
                                                "Only admin users can change tradition ownership" );