Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • P Policy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 23
    • Issues 23
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Open Subsurface Data Universe SoftwareOpen Subsurface Data Universe Software
  • Platform
  • Security and Compliance
  • Policy
  • Issues
  • #82
Closed
Open
Issue created Nov 01, 2022 by Dadong Zhou@dadong.zhouDeveloper

Translate api not working for http call

Tested an allow policy where the user groups are retrieved with http call from the Entitlements service:

package osdu.partition["osdu"].test_translate_api_3

import data.osdu.instance.entitlements

entitlementsApiResponse := entitlements.groups
permissionSet := {e | e := entitlementsApiResponse.body.groups[_].email}

allow {
  input.operation == ["view", "create", "update", "delete", "purge"][_]
  input.record.acl.owners[_] == permissionSet[_]
}

With the following input data:

{
  "query": "data.osdu.partition[\"osdu\"].test_translate_api_3.allow == true",
  "input": {
      "operation": "view",
      "groups": [
         "data.default.owners@osdu.example.com",
         "data.default.viewers@osdu.example.com"
      ]
   },
   "unknowns": [
      "input.record"
   ]
}

The translate api returns the following error msg:

{
    "detail": "An error occurred when talking translate service.  An exception of type AssertionError occurred. Arguments:\n()"
}

It should return the following:

{
  "query": {
    "bool": {
      "should": [
        {
          "bool": {
            "filter": [
              {
                "terms": {
                  "acl.owners": [
                    "data.default.owners@osdu.example.com",
                    "data.default.viewers@osdu.example.com",
                    ...
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}
Edited Nov 01, 2022 by Dadong Zhou
Assignee
Assign to
Time tracking