Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added ownership test to controller tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Dec 4, 2010
1 parent e708128 commit 9bb3815
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions components/journal/controllers/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ public function Display ( $pView = null, $pData = array ( ) ) {

public function Add ( $pView = null, $pData = array ( ) ) {

$this->_Focus = $this->Talk ( 'User', 'Focus' );
$this->_Current = $this->Talk ( 'User', 'Current' );
if ( !$this->_CheckAccess ( ) ) {
$this->GetSys ( 'Foundation' )->Redirect ( 'common/403.php' );
return ( false );
}

$this->View = $this->GetView ( 'edit' );

Expand All @@ -70,8 +72,10 @@ public function Add ( $pView = null, $pData = array ( ) ) {

public function Edit ( $pView = null, $pData = array ( ) ) {

$this->_Focus = $this->Talk ( 'User', 'Focus' );
$this->_Current = $this->Talk ( 'User', 'Current' );
if ( !$this->_CheckAccess ( ) ) {
$this->GetSys ( 'Foundation' )->Redirect ( 'common/403.php' );
return ( false );
}

$Identifier = $this->GetSys ( 'Request' )->Get ( 'Identifier' );

Expand Down Expand Up @@ -141,8 +145,10 @@ private function _PrepEdit ( ) {

public function Save ( ) {

$this->_Focus = $this->Talk ( 'User', 'Focus' );
$this->_Current = $this->Talk ( 'User', 'Current' );
if ( !$this->_CheckAccess ( ) ) {
$this->GetSys ( 'Foundation' )->Redirect ( 'common/403.php' );
return ( false );
}

$this->Model = $this->GetModel ();

Expand Down Expand Up @@ -172,11 +178,25 @@ public function Save ( ) {
exit;
}

public function Cancel ( ) {
private function _CheckAccess ( ) {

$this->_Focus = $this->Talk ( 'User', 'Focus' );
$this->_Current = $this->Talk ( 'User', 'Current' );

if ( ( $this->_Focus->Username != $this->_Current->Username ) or ( $this->_Focus->Domain != $this->_Current->Domain ) ) {
return ( false );
}

return ( true );
}

public function Cancel ( ) {

if ( !$this->_CheckAccess ( ) ) {
$this->GetSys ( 'Foundation' )->Redirect ( 'common/403.php' );
return ( false );
}

$Identifier = $this->GetSys ( 'Request' )->Get ( 'Identifier' );

if ( $Identifier ) {
Expand Down

0 comments on commit 9bb3815

Please sign in to comment.