| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
interface SH4_Conflicts_IAcl |
| 3 |
{ |
| 4 |
public function checkView( $shiftId ); |
| 5 |
} |
| 6 |
|
| 7 |
class SH4_Conflicts_Acl implements SH4_Conflicts_IAcl |
| 8 |
{ |
| 9 |
public function __construct( |
| 10 |
HC3_Hooks $hooks, |
| 11 |
SH4_Shifts_Query $shiftsQuery, |
| 12 |
HC3_Auth $auth |
| 13 |
) |
| 14 |
{ |
| 15 |
$this->self = $hooks->wrap( $this ); |
| 16 |
$this->auth = $hooks->wrap( $auth ); |
| 17 |
$this->shiftsQuery = $hooks->wrap( $shiftsQuery ); |
| 18 |
} |
| 19 |
|
| 20 |
public function checkView( $shiftId ) |
| 21 |
{ |
| 22 |
$return = FALSE; |
| 23 |
|
| 24 |
$shift = $this->shiftsQuery->findById( $shiftId ); |
| 25 |
if( ! ($shift && $shift->getId()) ){ |
| 26 |
return $return; |
| 27 |
} |
| 28 |
|
| 29 |
$currentUser = $this->auth->getCurrentUser(); |
| 30 |
$currentUserId = $currentUser->getId(); |
| 31 |
if( ! $currentUserId ){ |
| 32 |
return $return; |
| 33 |
} |
| 34 |
|
| 35 |
$return = TRUE; |
| 36 |
return $return; |
| 37 |
} |
| 38 |
} |