Ignore:
Timestamp:
01/22/12 19:38:41 (4 months ago)
Author:
CrawfordCurrie
Message:

Item11461: no functional changes, just some code cleanup and debugging used to complete this task

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WorkflowPlugin/lib/Foswiki/Plugins/WorkflowPlugin/ControlledTopic.pm

    r13770 r13783  
    183183# Some day we may handle the can... functions indepedently. For now, 
    184184# they all check editability thus.... 
    185 sub isModifyable { 
    186     my $this = shift; 
     185sub _isModifiable { 
     186    my ($this) = @_; 
     187    my $meta = $this->{meta}; 
    187188 
    188189    return $this->{isEditable} if defined $this->{isEditable}; 
    189190 
    190191    # See if the workflow allows an edit 
    191     unless ( defined $this->{isEditable} ) { 
    192         $this->{isEditable} = ( 
    193             $this->isLatestRev() 
    194  
    195               # Does the workflow permit editing? 
    196               && $this->{workflow}->allowEdit($this) 
    197  
    198               # Does Foswiki permit editing? 
    199               # DO NOT PASS $this->{meta}, because of Item11461 
    200               && Foswiki::Func::checkAccessPermission( 
    201                 'CHANGE',      $Foswiki::Plugins::SESSION->{user}, 
    202                 $this->{text}, $this->{topic}, 
    203                 $this->{web} 
    204               ) 
    205         ) ? 1 : 0; 
    206     } 
     192    # is the latest rev (or no rev) loaded? 
     193    $this->{isEditable} = $this->isLatestRev(); 
     194    #print STDERR "Modify denied by isLatestRev\n" unless $this->{isEditable}; 
     195 
     196    # Does the workflow permit editing? 
     197    if ($this->{isEditable}) { 
     198        $this->{isEditable} = $this->{workflow}->allowEdit($this); 
     199        #print STDERR "Modify denied by allowEdit\n" unless $this->{isEditable}; 
     200    } 
     201    # Does Foswiki permit editing? 
     202    if ($this->{isEditable}) { 
     203        # DO NOT PASS $this->{meta}, because of Item11461 
     204        $this->{isEditable} = Foswiki::Func::checkAccessPermission( 
     205            'CHANGE',      $Foswiki::Plugins::SESSION->{user}, 
     206            $this->{text}, $this->{topic}, 
     207            $this->{web} ) if $this->{isEditable}; 
     208        #print STDERR "Modify denied by checkAccessPermission\n" unless $this->{isEditable}; 
     209    } 
     210    $this->{isEditable} ||= 0; # ensure defined 
     211 
    207212    return $this->{isEditable}; 
    208213} 
     
    211216sub canEdit { 
    212217    my $this = shift; 
    213     return $this->isModifyable($this); 
     218    return $this->_isModifiable(); 
     219} 
     220 
     221# Return tue if this topic is editable 
     222sub canSave { 
     223    my $this = shift; 
     224    return $this->_isModifiable(); 
    214225} 
    215226 
     
    217228sub canAttach { 
    218229    my $this = shift; 
    219     return $this->isModifyable($this); 
     230    return $this->_isModifiable(); 
    220231} 
    221232 
     
    223234sub canFork { 
    224235    my $this = shift; 
    225     return $this->isModifyable($this); 
     236    return $this->_isModifiable(); 
    226237} 
    227238 
Note: See TracChangeset for help on using the changeset viewer.