def init_app(app):

    permissions_map = app.config.get(
        'RELENGAPI_PERMISSIONS', {}).get('permissions', {})

    # verify that each specified permission exists
    for perm in set(itertools.chain(*permissions_map.values())):
        try:
            p[perm]
        except KeyError:
            raise RuntimeError(
                "invalid static permission in settings: %r" % (perm,))

    permissions_stale.connect_via(app)(
        partial(on_permissions_stale, permissions_map))
def init_app(app):
    permissions_map = app.config.get('RELENGAPI_PERMISSIONS',
                                     {}).get('permissions', {})

    # verify that each specified permission exists
    for perm in set(itertools.chain(*permissions_map.values())):
        try:
            p[perm]
        except KeyError:
            raise RuntimeError("invalid static permission in settings: %r" %
                               (perm, ))

    permissions_stale.connect_via(app)(partial(on_permissions_stale,
                                               permissions_map))

    app.authz = StaticAuthz(permissions_map)
    def __init__(self, app):

        permissions_cfg = app.config.get('RELENGAPI_PERMISSIONS', {})
        self.group_permissions = permissions_cfg.get('group-permissions', {})

        # verify that each specified permission exists
        for perm in set(itertools.chain(*self.group_permissions.values())):
            try:
                p[perm]
            except KeyError:
                raise RuntimeError("invalid permission in settings: %r" %
                                   (perm, ))

        self.uri = permissions_cfg['uri']
        self.login_dn = permissions_cfg['login_dn']
        self.login_password = permissions_cfg['login_password']
        self.user_base = permissions_cfg['user_base']
        self.group_base = permissions_cfg['group_base']
        self.debug = permissions_cfg.get('debug')

        self.logger = logging.getLogger(__name__)

        permissions_stale.connect_via(app)(self.on_permissions_stale)
    def __init__(self, app):

        permissions_cfg = app.config.get('RELENGAPI_PERMISSIONS', {})
        self.group_permissions = permissions_cfg.get('group-permissions', {})

        # verify that each specified permission exists
        for perm in set(itertools.chain(*self.group_permissions.values())):
            try:
                p[perm]
            except KeyError:
                raise RuntimeError(
                    "invalid permission in settings: %r" % (perm,))

        self.uri = permissions_cfg['uri']
        self.login_dn = permissions_cfg['login_dn']
        self.login_password = permissions_cfg['login_password']
        self.user_base = permissions_cfg['user_base']
        self.group_base = permissions_cfg['group_base']
        self.debug = permissions_cfg.get('debug')

        self.logger = logging.getLogger(__name__)

        permissions_stale.connect_via(app)(self.on_permissions_stale)