Berlingske Permissions Processor API - is an API app that acts as a backend for the BPP admin and forwards the Gigya notifications to the AWS SQS for BPP worker to be consumed.
Via the BPP API it's possible to:
Messages must be send to the BPP Worker in case:

Scope
Scope is a BPC concept, and is this solution it is usually berlingske, bt and weekendavisen.
Role
A role is a true/false value that will grant access to a given product. E.g. bdk_paywall will grant access to article behind the paywall on www.berlingske.dk.
A role exists in a scope.
Access rules:
Access rules are a mapping between accessFeature+titleDomain, granted by ARIA based on the account master plan, and the scope:roles, that is set in BPC.
Each time a user's permissions are calculated, the accountFeatureList from Aria is used to find matching access rules. For each match
Scope access:
Scope access is the total list of scope:roles, that BPP will set in the access object BPC for a given user, each time permissions are calculated.
This means that all roles in all scopes will be set to either true or false, depending on the access rules of the user.
If a user's accountFeatureList has a matching access rule, the value will be true true. Otherwise false.
Company:
A B2B company or group that is allowed to share one access granted to ARIA account between multiple Gigya accounts.
Consider scope access:
[
{
"scope": "weekendavisen",
"roles": [ "wea_paywall", "waa_epaper" ]
},
{
"scope": "berlingske",
"roles": [ "bdk_paywall", "bdk_apps" ]
}
]
and consider access rules:
[
{
"accessFeature": "WEB/APP",
"eligibleForSharing": false,
"titleDomain": "www.weekendavisen.dk",
"access": {
"weekendavisen": [ "wea_paywall" ]
}
},
{
"accessFeature": "E-PAPER",
"eligibleForSharing": false,
"titleDomain": "www.weekendavisen.dk",
"access": {
"weekendavisen": [ "waa_epaper" ]
}
},
]
Consider a user's accountFeatureList (subscription includes access to WEA web but not E-paper nor any BER):
[
{
"accessFeature": "WEB/APP",
"eligibleForSharing": false,
"titleDomain": "www.weekendavisen.dk"
}
]
The resulting permissions access-object for each scope will be:
# /berlingske
{
"bdk_paywall": false, // <-- false because the role is listed in scope access but not matched to a rule or accountFeatureList
"bdk_apps": false, // <-- false because the role is listed in scope access but not matched to a rule or accountFeatureList
}
# /weekendavisen
{
"waa_epaper": false, // <-- false because the role is listed in scope access but not matched to a rule or accountFeatureList
"wea_paywall": true // <-- true because the role is listed in scope access and also matched to a rule in the user's accountFeatureList
}
For each unique UID in the events within a Gigya notifications a accounts.getAccountInfo request to Gigya is made, to retrieve the account email.
Compare the email from Gigya to the email stored in MongoDB on the account (Gigya UID = ariaAccountID).
Find companies where the Gigya UID is in the users-lists and "added by system".
Execute the logic from "accountCreated" to find and create any new memberships on a company.
The authorization header must be a Hawk header generated using a BPC Ticket.
Query:
Authorization:
Payload:
{ scope: [ "role_a", "role_b" ] })Authorization:
Authorization:
Deletes the accessrules.
Query:
Authorization:
Payload:
[ "role_a", "role_b" ])Authorization:
Authorization:
Deletes the scope access if it's not in use in any access rule.
example return:
[ { cid: '5e5e18e75f1cac21d79eec35', title: 'Company 6', ip_filter: [ "119.184.136.196" ], roles: [ 'bdk_paywall', 'biz_paywall', 'bdk_apps', 'bma_epaper' ] } ]
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
Just simply use
npm install
The worker uses these env vars:
You can put the vars into .sh file and run . config.sh && npm start
``
// Gigya configuration. GIGYA_DC=eu1 GIGYA_HOSTNAMEgigya.com GIGYA_PROTOCOL=https:// GIGYA_API_KEY || GIGYA_APP_KEY GIGYA_USER_KEY GIGYA_SECRET_KEY GIGYA_REQUEST_TIMEOUT_MS=2000;
See BPP Worker README Indexes
npm start // Starts the worker
npm run dev // Starts the worker and restarts on source changes
npm test // Runs the tests
node node_modules/@hapi/lab/bin/lab -vd // Shows test ids
node node_modules/@hapi/lab/bin/lab -i <id> // Runs single test with id
Alternative, install package $hapi/lab globally, and the lab commands can be shortened to lab -i <id>.
make run
to stop containers
make stop
cp ./.env.dev ./.env
docker-compose up --build mongo1 mongo2 mongo3
make config
docker-compose up --build bpp_api
docker exec --env MONGODB_HOST=mongo1 -it bpp_api node -e "const helpers = require('./test/helpers'); helpers.MongoDB.fill()"
docker exec -it mongo1 mongo
docker exec --env MONGODB_HOST=mongo1 --env MONGODB_NAME=bpp_testing -it bpp_api npm test
Content type
Image
Digest
sha256:19d857b0e…
Size
107.3 MB
Last updated
over 3 years ago
docker pull berlingskemedia/bpp_api