Bläddra i källkod

Add assets to campaigns' scopes if required.

master
Ben Kurtovic 8 år sedan
förälder
incheckning
fb4afca243
2 ändrade filer med 14 tillägg och 2 borttagningar
  1. +2
    -2
      README.md
  2. +12
    -0
      calefaction/modules/campaigns/__init__.py

+ 2
- 2
README.md Visa fil

@@ -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 Visa fil

@@ -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()

Laddar…
Avbryt
Spara