protected function check($service, $component = null, $requestor = ServiceRequestorTypes::API)
 {
     return Session::getServicePermissions($service, $component, $requestor);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getPermissions($resource = null)
 {
     $requestType = $this->request ? $this->request->getRequestorType() : ServiceRequestorTypes::API;
     return Session::getServicePermissions($this->name, $resource, $requestType);
 }
 /**
  * Checks to see if Access is Allowed based on Role-Service-Access.
  *
  * @return bool
  * @throws \DreamFactory\Core\Exceptions\NotImplementedException
  */
 public static function isAccessAllowed()
 {
     /** @var Router $router */
     $router = app('router');
     $service = strtolower($router->input('service'));
     $component = strtolower($router->input('resource'));
     $action = VerbsMask::toNumeric(\Request::getMethod());
     $allowed = Session::getServicePermissions($service, $component);
     return $action & $allowed ? true : false;
 }
 /**
  * @param string $resource
  *
  * @return int
  */
 public function getPermissions($resource = null)
 {
     $path = $this->getFullPathName();
     if (!empty($resource)) {
         $path = !empty($path) ? '/' . $resource : $resource;
     }
     $requestType = $this->request ? $this->request->getRequestorType() : ServiceRequestorTypes::API;
     return Session::getServicePermissions($this->getServiceName(), $path, $requestType);
 }