Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
add header checks
Browse files Browse the repository at this point in the history
  • Loading branch information
EDDYMENS committed Nov 2, 2016
1 parent 233d319 commit d85b2bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions app/Helpers/ActionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
class ActionClass
{



/**
* execute service action class
* @param string $service
Expand All @@ -23,7 +22,6 @@ public static function execute($service, $method, $params = null)
(file_exists($serviceMethodPath))?
require_once $serviceMethodPath : false;


$serviceInstance = new $service();
$results = $serviceInstance->$method(...$params);
return $results;
Expand Down
2 changes: 1 addition & 1 deletion app/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Helper
public static $validator_type =
[
'boolean' => 'boolean',
'decimals' => 'numeric',
'decimals' => 'numeric',
'email' => 'email',
'integer' => 'integer',
'password' => 'alphanum',
Expand Down
7 changes: 6 additions & 1 deletion app/Http/Controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function download_service_package($filename)
*/
public function service(Request $request, $service, $resource)
{

$this-> _devlessCheckHeaders($request);
$serviceOutput = $this->resource($request, $service, $resource);
return response($serviceOutput);
}
Expand Down Expand Up @@ -391,6 +391,11 @@ private function _get_resource_access_right($service)
$resource_access_right = json_decode($resource_access_right, true);
return $resource_access_right;
}

/**
* check if Devless headers are set
* @param type $request
*/
private function _devlessCheckHeaders($request)
{
$is_token_set = ($request->header('Devless-token') == $request['devless_token'] )? true : false;
Expand Down

0 comments on commit d85b2bb

Please sign in to comment.