addRpcService() публичный Метод

public addRpcService ( $serviceName, $action, array $privileges = null )
$privileges array
Пример #1
0
 /**
  * Create default privileges for a list of RPC services of the specified version
  *
  * @param array $services
  * @param AuthorizationEntity $entity
  * @param array $config Used to determine action associated with RPC service (via route config)
  * @param int $version
  */
 protected function createDefaultPrivilegesForRpcServices(
     array $services,
     AuthorizationEntity $entity,
     array $config,
     $version
 ) {
     foreach ($services as $serviceName => $serviceConfig) {
         if (!preg_match('/' . preg_quote('\\') . 'V' . $version . preg_quote('\\') . '/', $serviceName)) {
             continue;
         }
         $action = $this->discoverActionForRpcService($serviceName, $serviceConfig, $config);
         $entity->addRpcService($serviceName, $action);
     }
 }
 public function testAddingAnRpcServiceWithoutHttpMethodsProvidesDefaults()
 {
     $entity = new AuthorizationEntity();
     $entity->addRpcService('Foo\\V1\\Rpc\\Message\\Controller', 'message');
     $this->assertTrue($entity->has('Foo\\V1\\Rpc\\Message\\Controller::message'));
     $privileges = $entity->get('Foo\\V1\\Rpc\\Message\\Controller::message');
     $this->assertEquals(['GET' => false, 'POST' => false, 'PATCH' => false, 'PUT' => false, 'DELETE' => false], $privileges);
 }