mirror of
https://github.com/laurivosandi/certidude
synced 2024-11-04 20:38:12 +00:00
api: script: drop usage of global authority import
This commit is contained in:
parent
1cfb1b3293
commit
29f3e1fce9
@ -229,7 +229,7 @@ def certidude_app(log_handlers=[]):
|
|||||||
|
|
||||||
# Extended attributes for scripting etc.
|
# Extended attributes for scripting etc.
|
||||||
app.add_route("/api/signed/{cn}/attr/", AttributeResource(authority, namespace="machine"))
|
app.add_route("/api/signed/{cn}/attr/", AttributeResource(authority, namespace="machine"))
|
||||||
app.add_route("/api/signed/{cn}/script/", ScriptResource())
|
app.add_route("/api/signed/{cn}/script/", ScriptResource(authority))
|
||||||
|
|
||||||
# API calls used by pushed events on the JS end
|
# API calls used by pushed events on the JS end
|
||||||
app.add_route("/api/signed/{cn}/tag/", TagResource())
|
app.add_route("/api/signed/{cn}/tag/", TagResource())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import falcon
|
import falcon
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from certidude import const, config, authority
|
from certidude import const, config
|
||||||
from certidude.decorators import serialize
|
from certidude.decorators import serialize
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
from certidude.firewall import whitelist_subject
|
from certidude.firewall import whitelist_subject
|
||||||
@ -10,9 +10,12 @@ logger = logging.getLogger(__name__)
|
|||||||
env = Environment(loader=FileSystemLoader(config.SCRIPT_DIR), trim_blocks=True)
|
env = Environment(loader=FileSystemLoader(config.SCRIPT_DIR), trim_blocks=True)
|
||||||
|
|
||||||
class ScriptResource():
|
class ScriptResource():
|
||||||
|
def __init__(self, authority):
|
||||||
|
self.authority = authority
|
||||||
|
|
||||||
@whitelist_subject
|
@whitelist_subject
|
||||||
def on_get(self, req, resp, cn):
|
def on_get(self, req, resp, cn):
|
||||||
path, buf, cert, attribs = authority.get_attributes(cn)
|
path, buf, cert, attribs = self.authority.get_attributes(cn)
|
||||||
# TODO: are keys unique?
|
# TODO: are keys unique?
|
||||||
named_tags = {}
|
named_tags = {}
|
||||||
other_tags = []
|
other_tags = []
|
||||||
|
Loading…
Reference in New Issue
Block a user