| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
interface SH4_Schedule_IAcl |
| 3 |
{ |
| 4 |
public function checkMy( $params = array() ); |
| 5 |
} |
| 6 |
|
| 7 |
class SH4_Schedule_Acl implements SH4_Schedule_IAcl |
| 8 |
{ |
| 9 |
public $self, $appQuery, $auth; |
| 10 |
|
| 11 |
public function __construct( |
| 12 |
HC3_Hooks $hooks, |
| 13 |
|
| 14 |
SH4_App_Query $appQuery, |
| 15 |
HC3_Auth $auth |
| 16 |
) |
| 17 |
{ |
| 18 |
$this->self = $hooks->wrap( $this ); |
| 19 |
|
| 20 |
$this->appQuery = $hooks->wrap( $appQuery ); |
| 21 |
$this->auth = $hooks->wrap( $auth ); |
| 22 |
} |
| 23 |
|
| 24 |
public function checkMy( $params = array() ) |
| 25 |
{ |
| 26 |
$return = FALSE; |
| 27 |
|
| 28 |
$currentUser = $this->auth->getCurrentUser(); |
| 29 |
$currentUserId = $currentUser->getId(); |
| 30 |
if( ! $currentUserId ){ |
| 31 |
return $return; |
| 32 |
} |
| 33 |
|
| 34 |
$currentUserId = $currentUser->getId(); |
| 35 |
if( ! $currentUserId ){ |
| 36 |
return $return; |
| 37 |
} |
| 38 |
|
| 39 |
// as employee |
| 40 |
$meEmployee = $this->appQuery->findEmployeeByUser( $currentUser ); |
| 41 |
if( ! $meEmployee ){ |
| 42 |
return $return; |
| 43 |
} |
| 44 |
|
| 45 |
$return = TRUE; |
| 46 |
return $return; |
| 47 |
} |
| 48 |
} |