original_string: public function checkPermission($model, $member = null, $httpMethod)
      {
          if (is_string($model)) {
              $model = singleton($model);
          }
  
          // check permission depending on HTTP verb
          // default to true
          switch (strtoupper($httpMethod)) {
              case 'GET':
                  return $model->canView($member);
                  break;
  
              case 'POST':
                  return $model->canCreate($member);
                  break;
  
              case 'PUT':
                  return $model->canEdit($member);
                  break;
  
              case 'DELETE':
                  return $model->canDelete($member);
                  break;
  
              default:
                  return true;
                  break;
          }
      }
code: public function checkPermission($model, $member = null, $httpMethod)
      {
          if (is_string($model)) {
              $model = singleton($model);
          }
  
          // check permission depending on HTTP verb
          // default to true
          switch (strtoupper($httpMethod)) {
              case 'GET':
                  return $model->canView($member);
                  break;
  
              case 'POST':
                  return $model->canCreate($member);
                  break;
  
              case 'PUT':
                  return $model->canEdit($member);
                  break;
  
              case 'DELETE':
                  return $model->canDelete($member);
                  break;
  
              default:
                  return true;
                  break;
          }
      }
code_tokens: public function checkPermission ( $ model , $ member = null , $ httpMethod ) { if ( is_string ( $ model ) ) { $ model = singleton ( $ model ) ; } // check permission depending on HTTP verb // default to true switch ( strtoupper ( $ httpMethod ) ) { case 'GET' : return $ model -> canView ( $ member ) ; break ; case 'POST' : return $ model -> canCreate ( $ member ) ; break ; case 'PUT' : return $ model -> canEdit ( $ member ) ; break ; case 'DELETE' : return $ model -> canDelete ( $ member ) ; break ; default : return true ; break ; } }
docstring: Checks if a given DataObject or Class
  can be accessed with a given API request by a Member
  
  @param  string|DataObject       $model       Model's classname or DataObject to check permission for
  @param  DataObject|null         $member      Member to check permission agains
  @param  string                  $httpMethod  API request HTTP method
  @return Boolean                              true or false if permission was given or not
docstring_tokens: Checks if a given DataObject or Class can be accessed with a given API request by a Member