-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix IsAccessListModeApplicable Check
#172 Fixed so IsAccessListModeApplicable use the users delegable right model and not the input model for the check Related Work Items: #17
- Loading branch information
Jon Kjetil Øye
committed
Dec 16, 2024
1 parent
90f44d7
commit cd479f9
Showing
4 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ion/RightsInternal/accesslist-resource/AccessListDelegation_Dagl_OrgWithPartialAccess.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
meta { | ||
name: AccessListDelegation_Dagl_OrgWithPartialAccess | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
post { | ||
url: {{baseUrl}}/accessmanagement/api/v1/internal/{{party}}/rights/delegation/delegationcheck | ||
body: json | ||
auth: inherit | ||
} | ||
|
||
body:json { | ||
{ | ||
"resource": [ | ||
{ | ||
"id": "urn:altinn:resource", | ||
"value": "{{resource}}" | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const testdata = require(`./Testdata/accesslist-delegation/${bru.getEnvVar("tokenEnv")}.json`); | ||
const sharedtestdata = require(`./Testdata/sharedtestdata.json`); | ||
bru.setVar("party", testdata.OrdentligUlasteligStruts.partyid); | ||
bru.setVar("resource", testdata.resource); | ||
|
||
var getTokenParameters = { | ||
auth_tokenType: sharedtestdata.authTokenType.personal, | ||
auth_userId: testdata.OrdentligUlasteligStruts.dagl.userid, | ||
auth_partyId: testdata.OrdentligUlasteligStruts.dagl.partyid, | ||
auth_ssn: testdata.OrdentligUlasteligStruts.dagl.pid | ||
} | ||
|
||
const token = await testTokenGenerator.getToken(getTokenParameters); | ||
bru.setVar("bearerToken", token); | ||
} | ||
|
||
tests { | ||
// Should be the same as the .bru request file. Used as prefix in test name which also shows in test result in pipeline. | ||
const requestName = "AccessListDelegation_Dagl_OrgWithPartialAccess"; | ||
const body = res.getBody(); | ||
|
||
test(requestName + "|HttpStatus.OK", function() { | ||
expect(res.status).to.equal(200); | ||
}); | ||
|
||
test(requestName + "|Read_IsDelegable", function() { | ||
const right = body.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:read"); | ||
assert.equal(right.status, "Delegable", `Expected read to be: Delegable`); | ||
}); | ||
|
||
test(requestName + "|Write_IsNotDelegable", function() { | ||
const right = body.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:write"); | ||
assert.equal(right.status, "NotDelegable", `Expected write to be; NotDelegable`); | ||
}); | ||
} |
17 changes: 17 additions & 0 deletions
17
...essManagement/test/Bruno/Altinn.AccessManagement/Testdata/accesslist-delegation/at22.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": "at22", | ||
"resource": "devtest_gar_bruno_accesslist_actionfilter", | ||
"OrdentligUlasteligStruts": { | ||
"orgno": "313776735", | ||
"name": "ORDENTLIG ULASTELIG STRUTS LTD", | ||
"partyid": 51655628, | ||
"partyuuid": "5d99cf7c-2cce-42f7-a07b-516e52ece2e9", | ||
"dagl": { | ||
"pid": "12819498464", | ||
"name": "KRAMPE VEIK", | ||
"userid": 20012620, | ||
"partyid": 50656486, | ||
"partyuuid": "a30eea39-348b-444b-9342-8172f756a6f8" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...essManagement/test/Bruno/Altinn.AccessManagement/Testdata/accesslist-delegation/tt02.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": "tt02", | ||
"resource": "devtest_gar_bruno_accesslist_actionfilter", | ||
"OrdentligUlasteligStruts": { | ||
"orgno": "313776735", | ||
"name": "ORDENTLIG ULASTELIG STRUTS LTD", | ||
"partyid": 51868999, | ||
"partyuuid": "e5c0efcd-d806-48de-8476-9feb6a710d4c", | ||
"dagl": { | ||
"pid": "12819498464", | ||
"name": "KRAMPE VEIK", | ||
"userid": 1290037, | ||
"partyid": 50669264, | ||
"partyuuid": "39210c03-09df-4b8c-92a4-b0763e132ba6" | ||
} | ||
} | ||
} |