public static function find(array $params = []) { $params['where'] = (array) U::array_value($params, 'where'); $user = self::$injectedApp['user']; if (!$user->isAdmin()) { if (isset($params['where']['organization'])) { $org = new Organization($params['where']['organization']); if ($org->getRoleOfUser($user) < Volunteer::ROLE_VOLUNTEER) { return ['models' => [], 'count' => 0]; } } else { return ['models' => [], 'count' => 0]; } } return parent::find($params); }
public static function find(array $params = []) { $params['where'] = (array) U::array_value($params, 'where'); $user = self::$injectedApp['user']; if (isset($params['where']['organization']) && !$user->isAdmin()) { if (!isset($params['where']['approval_link'])) { $org = new Organization($params['where']['organization']); if ($org->getRoleOfUser($user) != Volunteer::ROLE_ADMIN) { $params['where']['uid'] = $user->id(); } } } else { // for now, leaving volunteer activity public // this means any one can view volunteer hours with: // GET /api/volunteers/volunteer_hours } return parent::find($params); }