瀏覽代碼

Add assets to campaigns' scopes if required.

master
Ben Kurtovic 8 年之前
父節點
當前提交
fb4afca243
共有 2 個檔案被更改,包括 14 行新增2 行删除
  1. +2
    -2
      README.md
  2. +12
    -0
      calefaction/modules/campaigns/__init__.py

+ 2
- 2
README.md 查看文件

@@ -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 查看文件

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

Loading…
取消
儲存