Skip to content

Commit afcb969

Browse files
authored
Use @sap/ams 3.0.0 in CAP sample (#6)
Update CAP sample * @sap/ams 3.0.0 and @sap/ams-dev 2.1.2 * add tests for technicalUser and principalPropagation * add .vscode to .gitignore
1 parent 109eeaf commit afcb969

File tree

8 files changed

+933
-287
lines changed

8 files changed

+933
-287
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode

ams-cap-nodejs-bookshop/.cdsrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@
3030
"local.Zealot",
3131
"local.BestsellerReader"
3232
]
33+
},
34+
"technicalUser": {
35+
"roles": [
36+
"system-user"
37+
],
38+
"ias_apis": [
39+
"ReadCatalog"
40+
]
41+
},
42+
"principalPropagation": {
43+
"policies": [
44+
"local.JuniorReader"
45+
],
46+
"ias_apis": [
47+
"ReadCatalog"
48+
]
3349
}
3450
}
3551
},
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const TECHNICAL_USER_APIS = [
2+
"ReadCatalog"
3+
]
4+
5+
const PRINCIPAL_PROPAGATION_APIS = [
6+
"AMS_ValueHelp",
7+
"ReadCatalog"
8+
]
9+
10+
function mapTechnicalUserApi(api) {
11+
if (TECHNICAL_USER_APIS.includes(api)) {
12+
return `internal.${api}`;
13+
}
14+
}
15+
16+
function mapPrincipalPropagationApi(api) {
17+
if (PRINCIPAL_PROPAGATION_APIS.includes(api)) {
18+
return `internal.${api}`;
19+
}
20+
}
21+
22+
module.exports = {
23+
mapTechnicalUserApi,
24+
mapPrincipalPropagationApi
25+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
INTERNAL Policy AMS_ValueHelp {
2+
USE cap.Reader;
3+
}
4+
5+
INTERNAL Policy ReadCatalog {
6+
USE cap.Reader RESTRICT stock < 30, description IS NOT RESTRICTED, genre IS NOT RESTRICTED;
7+
}

0 commit comments

Comments
 (0)