Bladeren bron

Add assets to campaigns' scopes if required.

master
Ben Kurtovic 5 jaren geleden
bovenliggende
commit
fb4afca243
2 gewijzigde bestanden met toevoegingen van 14 en 2 verwijderingen
  1. +2
    -2
      README.md
  2. +12
    -0
      calefaction/modules/campaigns/__init__.py

+ 2
- 2
README.md Bestand weergeven

@@ -20,9 +20,9 @@ Guide
cp config/config.yml.sample config/config.yml
vim config/config.yml # follow instructions
cat data/schema.sql | sqlite3 data/db.sqlite3
mkdir logs
mkdir logs templates/.cache
sudo chmod 0600 config/config.yml data/db.sqlite3
sudo chown www-data:www-data config/config.yml data data/db.sqlite3 logs
sudo chown www-data:www-data config/config.yml data data/db.sqlite3 logs templates/.cache
... # TODO: convert these into scripts, add SDE instructions, add module instructions

### Test


+ 12
- 0
calefaction/modules/campaigns/__init__.py Bestand weergeven

@@ -3,3 +3,15 @@
from .getters import get_current, get_overview, get_summary, get_unit
from .routes import home, navitem
from .._provided import config

def _get_scopes():
"""Determine the required scopes, depending on enabled operations."""
for cname in config["enabled"]:
campaign = config["campaigns"][cname]
for opname in campaign["enabled"]:
optype = campaign["operations"][opname]["type"]
if optype == "collection":
return {"esi-assets.read_assets.v1"}
return {}

SCOPES = _get_scopes()

Laden…
Annuleren
Opslaan