diff --git a/.github/workflows/build_and_test_cap.yml b/.github/workflows/build_and_test_cap.yml index eaf4a74..1e35389 100644 --- a/.github/workflows/build_and_test_cap.yml +++ b/.github/workflows/build_and_test_cap.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: CAP sample +name: CAP sample - Build and Test on: push: @@ -27,6 +27,13 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: true + - name: Sparse checkout 'dcl' in ams submodule + run: | + cd ams + git sparse-checkout init --cone + git sparse-checkout set dcl - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: @@ -38,7 +45,5 @@ jobs: with: java-version: '17' distribution: 'temurin' - - run: npm ci - working-directory: ams-cap-nodejs-bookshop - - run: npm test - working-directory: ams-cap-nodejs-bookshop \ No newline at end of file + - run: npm --prefix ams-cap-nodejs-bookshop ci + - run: npm --prefix ams-cap-nodejs-bookshop test \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b33ad86 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ams-cap-nodejs-bookshop/ams"] + path = ams-cap-nodejs-bookshop/ams + url = git@github.wdf.sap.corp:I577963/ams-cap-sample-policies.git diff --git a/ams-cap-nodejs-bookshop/ams b/ams-cap-nodejs-bookshop/ams new file mode 160000 index 0000000..0a25874 --- /dev/null +++ b/ams-cap-nodejs-bookshop/ams @@ -0,0 +1 @@ +Subproject commit 0a258748194f5d2f516d11e13f8b933bd126b0de diff --git a/ams-cap-nodejs-bookshop/ams/dcl/cap/basePolicies.dcl b/ams-cap-nodejs-bookshop/ams/dcl/cap/basePolicies.dcl deleted file mode 100644 index 2a16870..0000000 --- a/ams-cap-nodejs-bookshop/ams/dcl/cap/basePolicies.dcl +++ /dev/null @@ -1,12 +0,0 @@ -POLICY "Reader" { - ASSIGN ROLE "Reader" WHERE (description IS NOT RESTRICTED OR genre IS NOT RESTRICTED) AND stock IS NOT RESTRICTED; -} - -POLICY Inquisitor { - ASSIGN ROLE "Inquisitor" WHERE description IS NOT RESTRICTED; -} - -POLICY "admin" { - ASSIGN ROLE "admin"; -} - diff --git a/ams-cap-nodejs-bookshop/ams/dcl/internal/apiPolicies.dcl b/ams-cap-nodejs-bookshop/ams/dcl/internal/apiPolicies.dcl deleted file mode 100644 index 1a63dba..0000000 --- a/ams-cap-nodejs-bookshop/ams/dcl/internal/apiPolicies.dcl +++ /dev/null @@ -1,7 +0,0 @@ -INTERNAL Policy AMS_ValueHelp { - USE cap.Reader; -} - -INTERNAL Policy ReadCatalog { - USE cap.Reader RESTRICT stock < 30, description IS NOT RESTRICTED, genre IS NOT RESTRICTED; -} \ No newline at end of file diff --git a/ams-cap-nodejs-bookshop/ams/dcl/local/adminPolicies.dcl b/ams-cap-nodejs-bookshop/ams/dcl/local/adminPolicies.dcl deleted file mode 100644 index d36edb8..0000000 --- a/ams-cap-nodejs-bookshop/ams/dcl/local/adminPolicies.dcl +++ /dev/null @@ -1,13 +0,0 @@ -POLICY JuniorReader { - USE cap.Reader RESTRICT description LIKE '%happy%ending%', genre IN ('Fantasy', 'Fairy Tale'), - stock IS NOT RESTRICTED; -} - -POLICY BestsellerReader { - USE cap.Reader RESTRICT stock < 20, - description IS NOT RESTRICTED, genre IS NOT RESTRICTED; -} - -POLICY Zealot { - USE cap.Inquisitor RESTRICT description LIKE '%religious%references%'; -} \ No newline at end of file diff --git a/ams-cap-nodejs-bookshop/ams/dcl/schema.dcl b/ams-cap-nodejs-bookshop/ams/dcl/schema.dcl deleted file mode 100644 index 4810f25..0000000 --- a/ams-cap-nodejs-bookshop/ams/dcl/schema.dcl +++ /dev/null @@ -1,17 +0,0 @@ -// ---------------------------------HEADER_START----------------------------------------------- -// Generated from a CAP model by the SAP AMS Plugin (@sap/ams) 2.0.0 -// hash of generated content: 8537b8096e1fb048199d1f1559d5eefc36a8df54921c560050a413d40c07688b -// ----------------------------------HEADER_END------------------------------------------------ - -SCHEMA { - description: String, - genre: String, - just: { - for: { - showcasing: { - attributeNesting: Number - } - } - }, - stock: Number -} \ No newline at end of file