public function prepareXml()

in modules/quanthub_core/src/XacmlSoapClient.php [142:207]


  public function prepareXml() {
    $xml = new \SimpleXMLElement('<Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="false"></Request>');

    $attributes = $xml->addChild('Attributes');
    $attributes->addAttribute('Category', 'Quanthub:Action');

    $attribute = $attributes->addChild('Attribute');
    $attribute->addAttribute('AttributeId', 'Quanthub:Action:Type');
    $attribute->addAttribute('IncludeInResult', 'false');

    $attributeValue = $attribute->addChild('AttributeValue', 'Dataset.List');
    $attributeValue->addAttribute('DataType', $this::DATA_TYPE);

    $attributes = $xml->addChild('Attributes');
    $attributes->addAttribute('Category', 'Quanthub:Entities');

    $attribute = $attributes->addChild('Attribute');
    $attribute->addAttribute('AttributeId', 'Quanthub:Workspace:Access');
    $attribute->addAttribute('IncludeInResult', 'false');
    $attributeValue = $attribute->addChild('AttributeValue', 'RESTRICTED');
    $attributeValue->addAttribute('DataType', $this::DATA_TYPE);

    $attribute = $attributes->addChild('Attribute');
    $attribute->addAttribute('AttributeId', 'Quanthub:Workspace:Name');
    $attribute->addAttribute('IncludeInResult', 'false');
    $attributeValue = $attribute->addChild('AttributeValue', 'go');
    $attributeValue->addAttribute('DataType', $this::DATA_TYPE);

    $attribute = $attributes->addChild('Attribute');
    $attribute->addAttribute('AttributeId', 'Quanthub:Entitlement:Environment');
    $attribute->addAttribute('IncludeInResult', 'false');
    $attributeValue = $attribute->addChild('AttributeValue', 'PORTALS');
    $attributeValue->addAttribute('DataType', $this::DATA_TYPE);

    $attributes = $xml->addChild('Attributes');
    $attributes->addAttribute('Category', 'Quanthub:User');

    $attribute = $attributes->addChild('Attribute');
    $attribute->addAttribute('AttributeId', 'Quanthub:User:Role');
    $attribute->addAttribute('IncludeInResult', 'false');

    $roles = $this->userInfo->getUserInfoRole();
    foreach ($roles as $role) {
      $attributeValue = $attribute->addChild('AttributeValue', $role);
      $attributeValue->addAttribute('DataType', $this::DATA_TYPE);
    }

    if ($this->currentUser->isAuthenticated()) {
      $attribute = $attributes->addChild('Attribute');
      $attribute->addAttribute('AttributeId', 'Quanthub:User:UserID');
      $attribute->addAttribute('IncludeInResult', 'false');
      $attributeValue = $attribute->addChild('AttributeValue', $this->userInfo->getQuanthubUserId());
      $attributeValue->addAttribute('DataType', $this::DATA_TYPE);

      $attribute = $attributes->addChild('Attribute');
      $attribute->addAttribute('AttributeId', 'Quanthub:User:Groups');
      $attribute->addAttribute('IncludeInResult', 'false');
      $groups = $this->userInfo->getUserInfoGroups();
      foreach ($groups as $group) {
        $attributeValue = $attribute->addChild('AttributeValue', $group);
        $attributeValue->addAttribute('DataType', $this::DATA_TYPE);
      }
    }

    return $xml->asXML();
  }