Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ams-cap-nodejs-bookshop/.cdsrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,32 @@
"[development]": {
"kind": "mocked",
"users": {
"bob": {
"policies": [
"cap.admin",
"cap.Reader"
]
},
"carol": {
"roles": [
"Reader"
]
},
"dave": {
"policies": [
"local.JuniorReader"
]
},
"erin": {
"policies": [
"local.BestsellerReader"
]
},
"fred": {
"policies": [
"local.JuniorReader",
"local.BestsellerReader"
]
}
}
},
Expand Down
8 changes: 3 additions & 5 deletions ams-cap-nodejs-bookshop/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Minimal Version before AMS
# Minimal Version with AMS

This branch is a minimal version of the sample from the [main](../../tree/main) branch used as basis for demos.
This branch is a minimal version of the sample from the [main](../../tree/main) branch shown in demos.

It shows the project before adding **AMS**.

For comparison, the [cap_minimal](../../cap_minimal/ams-cap-nodejs-bookshop) branch shows the minimal project after adding **AMS**.
It shows the [cap_minimal_before_ams](../../cap_minimal_before_ams/ams-cap-nodejs-bookshop) branch after adding **AMS**.
8 changes: 8 additions & 0 deletions ams-cap-nodejs-bookshop/ams/dcl/cap/basePolicies.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POLICY "Reader" {
ASSIGN ROLE "Reader" WHERE genre IS NOT RESTRICTED AND stock IS NOT RESTRICTED;
}

POLICY "admin" {
ASSIGN ROLE "admin";
}

7 changes: 7 additions & 0 deletions ams-cap-nodejs-bookshop/ams/dcl/local/adminPolicies.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
POLICY JuniorReader {
USE cap.Reader RESTRICT genre IN ('Fantasy', 'Fairy Tale'), stock IS NOT RESTRICTED;
}

POLICY BestsellerReader {
USE cap.Reader RESTRICT stock < 20, genre IS NOT RESTRICTED;
}
9 changes: 9 additions & 0 deletions ams-cap-nodejs-bookshop/ams/dcl/schema.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ---------------------------------HEADER_START-----------------------------------------------
// Generated from a CAP model by the SAP AMS Plugin (@sap/ams) 2.0.0
// hash of generated content: 0053f530a13e8c37fa5abb59a1d1ca5fb77372829de1be91ad799387bb641a0a
// ----------------------------------HEADER_END------------------------------------------------

SCHEMA {
genre: String,
stock: Number
}
Binary file modified ams-cap-nodejs-bookshop/db.sqlite
Binary file not shown.
Loading