Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(authz): incorrect handling of multi-types in get subject access rights #1140

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

bobeal
Copy link
Member

@bobeal bobeal commented Apr 21, 2024

No description provided.

@bobeal bobeal requested a review from ranim-n April 21, 2024 11:19
@bobeal bobeal self-assigned this Apr 21, 2024
@github-actions github-actions bot added the fix Something isn't working label Apr 21, 2024
@bobeal bobeal added the authz Relates to auth(z) topics label Apr 21, 2024
Copy link
Contributor

Test Results

 56 files  ±0   56 suites  ±0   1m 22s ⏱️ ±0s
929 tests +1  928 ✅ ±0  0 💤 ±0  1 ❌ +1 
968 runs  +1  967 ✅ ±0  0 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 6613272. ± Comparison against base commit 474ce52.

This pull request removes 103 and adds 18 tests. Note that renamed tests count towards both.
                         …, withTemporalValues=true, withAudit=false, expectation={
                      "@type": "@json",
                    "@value": "/A/B"
                    "@value": "/C/D"
                    "@value": 20
                    "…
                    {
                  "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
                  "@value": "2020-03-25T08:29:17.965206Z"
                  "@value": "2020-03-25T08:33:17.965206Z"
…
com.egm.stellio.search.authorization.EntityAccessRightsServiceTests ‑ it should get all entities an user has access to wrt access rights and types()
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [10] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=e9d9cb92-00f0-4be5-9cd0-4e77ee13377b, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=STRING, datasetId=null, createdAt=2024-04-21T11:24:57.580136210Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=a39b3e66-780b-408c-80d7-dd5adf841a62, value=Beehive_incoming_123, time=2020-03-25T08:29:17.965206Z), SimplifiedAttributeInstanceRe…, withTemporalValues=true, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://ontology.eglobalmark.com/apic#incoming": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/Property"
      ],
      "https://uri.etsi.org/ngsi-ld/hasValues": [
        {
          "@list": [
            {
              "@list": [
                {
                  "@value": "Beehive_incoming_123"
                },
                {
                  "@value": "2020-03-25T0…
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [11] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=8b870c47-10f5-48f1-ba69-fd17ffd66f10, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Relationship, attributeValueType=STRING, datasetId=urn:ngsi-ld:Dataset:45678, createdAt=2024-04-21T11:24:57.580136210Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=54d811aa-b02d-4874-8ecb-a535b8a5f7b7, value=urn:ngsi-ld:Entity:1234, time=2020-03-25T08:29:17.965206Z), S…, withTemporalValues=true, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://ontology.eglobalmark.com/apic#incoming": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/Relationship"
      ],
      "https://uri.etsi.org/ngsi-ld/datasetId": [
        {
          "@id": "urn:ngsi-ld:Dataset:45678"
        }
      ],
      "https://uri.etsi.org/ngsi-ld/hasObjects": [
        {
          "@list": [
            {
              "@list": [
                {
…
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [12] scopeHistory=[SimplifiedScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/A/B, /C/D], time=2020-03-25T08:29:17.965206Z), SimplifiedScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/C/D], time=2020-03-25T09:29:17.965206Z)], attributeAndResultsMap={}, withTemporalValues=true, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://uri.etsi.org/ngsi-ld/scope": {
    "@type": [
      "https://uri.etsi.org/ngsi-ld/Property"
    ],
    "https://uri.etsi.org/ngsi-ld/hasValues": [
      {
        "@list": [
          {
            "@list": [
              {
                "@list": [
                  {
                    "@value": "/A/B"
                  },
                  {
                    "@value": "/C/D"
   …
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [13] scopeHistory=[FullScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/A/B, /C/D], time=2020-03-25T08:29:17.965206Z, timeproperty=modifiedAt, sub=null), FullScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/C/D], time=2020-03-25T09:29:17.965206Z, timeproperty=modifiedAt, sub=null)], attributeAndResultsMap={}, withTemporalValues=false, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://uri.etsi.org/ngsi-ld/scope": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/Property"
      ],
      "https://uri.etsi.org/ngsi-ld/hasValue": [
        {
          "@value": "/A/B"
        },
        {
          "@value": "/C/D"
        }
      ],
      "https://uri.etsi.org/ngsi-ld/modifiedAt": [
        {
          "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
     …
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [14] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=4e17a5b4-7e61-4c83-8656-cf26b9dcb2ba, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#luminosity, attributeType=JsonProperty, attributeValueType=JSON, datasetId=null, createdAt=2024-04-21T11:24:57.580136210Z, modifiedAt=null, payload=JsonByteArrayInput{{ "id": "123", "stringValue": "value", "nullValue": null }})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=74a9500a-5e13-4237-9b26-df8367d0fac1, value=
                         …, withTemporalValues=true, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://ontology.eglobalmark.com/apic#luminosity": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/JsonProperty"
      ],
      "https://uri.etsi.org/ngsi-ld/jsons": [
        {
          "@list": [
            {
              "@list": [
                {
                  "https://uri.etsi.org/ngsi-ld/hasJSON": [
                    {
                      "@type": "@json",
     …
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [1] entityTemporalResults=[EntityTemporalResult(entityPayload=EntityPayload(entityId=urn:ngsi-ld:BeeHive:TESTC, types=[https://ontology.eglobalmark.com/apic#BeeHive], scopes=null, createdAt=2024-04-21T11:24:57.569692624Z, modifiedAt=null, payload=JsonByteArrayInput{{}}, specificAccessPolicy=null), scopeHistory=[], teaInstancesResult={TemporalEntityAttribute(id=aedbc18b-c93a-4181-bdbd-7f78d0ff8649, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValue…, withTemporalValues=false, withAudit=true, expectation=[
   {
      "@id": "urn:ngsi-ld:BeeHive:TESTC",
      "@type": [
         "https://ontology.eglobalmark.com/apic#BeeHive"
      ],
      "https://ontology.eglobalmark.com/apic#incoming": [
         {
            "@type": [
               "https://uri.etsi.org/ngsi-ld/Property"
            ],
            "https://uri.etsi.org/ngsi-ld/observedAt": [
               {
                  "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
                  "@value": "2020-03-25T08:33:17.965206Z"
               }
…
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [1] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=074ac4c2-8dce-4a7d-a66a-71570310d4b7, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=NUMBER, datasetId=null, createdAt=2024-04-21T11:24:57.580136210Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=67eb9446-77de-4871-8b6a-eae9349a3936, payload={"@type":["https://uri.etsi.org/ngsi-ld/Property"],"https://uri.etsi.org/ngsi-ld/observedA…, withTemporalValues=false, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://ontology.eglobalmark.com/apic#incoming": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/Property"
      ],
      "https://uri.etsi.org/ngsi-ld/observedAt": [
        {
          "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
          "@value": "2020-03-25T08:29:17.965206Z"
        }
      ],
      "https://uri.etsi.org/ngsi-ld/instanceId": [
        {
          "@id":…
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [2] entityTemporalResults=[EntityTemporalResult(entityPayload=EntityPayload(entityId=urn:ngsi-ld:BeeHive:TESTC, types=[https://ontology.eglobalmark.com/apic#BeeHive], scopes=null, createdAt=2024-04-21T11:24:57.569692624Z, modifiedAt=null, payload=JsonByteArrayInput{{}}, specificAccessPolicy=null), scopeHistory=[], teaInstancesResult={TemporalEntityAttribute(id=32648f73-4b75-4443-b352-7042dc721b34, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValue…, withTemporalValues=true, withAudit=false, expectation=[
  {
    "@id": "urn:ngsi-ld:BeeHive:TESTC",
    "@type": [
      "https://ontology.eglobalmark.com/apic#BeeHive"
    ],
    "https://ontology.eglobalmark.com/apic#incoming": [
      {
        "@type": [
          "https://uri.etsi.org/ngsi-ld/Property"
        ],
        "https://uri.etsi.org/ngsi-ld/hasValues": [
          {
            "@list": [
              {
                "@list": [
                  {
                    "@value": 20
                  },
                  {
                    "…
com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [2] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=987dd684-16a2-41db-b0f2-69d9dce59a9a, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Relationship, attributeValueType=STRING, datasetId=null, createdAt=2024-04-21T11:24:57.580136210Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=18734347-5ba8-4888-b789-9aaafe036a39, payload={"@type":["https://uri.etsi.org/ngsi-ld/Relationship"],"https://uri.etsi.org/ngsi-ld/o…, withTemporalValues=false, withAudit=false, expectation={
  "@id": "urn:ngsi-ld:BeeHive:TESTC",
  "@type": [
    "https://ontology.eglobalmark.com/apic#BeeHive"
  ],
  "https://ontology.eglobalmark.com/apic#incoming": [
    {
      "@type": [
        "https://uri.etsi.org/ngsi-ld/Relationship"
      ],
      "https://uri.etsi.org/ngsi-ld/observedAt": [
        {
          "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
          "@value": "2020-03-25T08:29:17.965206Z"
        }
      ],
      "https://uri.etsi.org/ngsi-ld/instanceId": [
        {
          "@…
…

@bobeal bobeal merged commit 05a83b1 into develop Apr 22, 2024
8 of 10 checks passed
@bobeal bobeal deleted the fix/multiple-types-in-get-authorized-entities branch April 22, 2024 09:23
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
authz Relates to auth(z) topics fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants