Beispiel #1
0
 def __call__(self, klass=None):
     if klass is None:
         if 'factory' not in self.config:
             raise Exception('Must provide factory configuration when defining '
                             'without a class')
         klass = get_caller_module()
     return super(_factory_decorator, self).__call__(klass)
Beispiel #2
0
def grant_all(principal=None, role=None):
    register_configuration(
        get_caller_module(),
        dict(
            principal=principal,
            role=role),
        'grant_all')
Beispiel #3
0
def grant(principal=None, role=None, permission=None, permissions=None):
    register_configuration(
        get_caller_module(),
        dict(principal=principal,
             role=role,
             permission=permission,
             permissions=permissions), 'grant')
Beispiel #4
0
def grant_all(principal=None, role=None):
    register_configuration(
        get_caller_module(),
        dict(
            principal=principal,
            role=role),
        'grant_all')
Beispiel #5
0
 def __call__(self, klass=None):
     if klass is None:
         if 'factory' not in self.config:
             raise Exception('Must provide factory configuration when defining '
                             'without a class')
         klass = get_caller_module()
     return super(_factory_decorator, self).__call__(klass)
Beispiel #6
0
def permission(id, title, description=''):
    register_configuration(
        get_caller_module(),
        dict(
            id=id,
            title=title,
            description=description),
        'permission')
Beispiel #7
0
def permission(id, title, description=''):
    register_configuration(
        get_caller_module(),
        dict(
            id=id,
            title=title,
            description=description),
        'permission')
Beispiel #8
0
def role(id, title, description='', local=True):
    register_configuration(
        get_caller_module(),
        dict(
            id=id,
            title=title,
            description=description,
            local=local),
        'role')
Beispiel #9
0
def json_schema_definition(name: str, schema: dict) -> None:
    """
    Register a json schema definition

    :param name: Name of schema
    :param schema: schema definition, must be json compatible
    """
    register_configuration(get_caller_module(), dict(name=name, schema=schema),
                           "json_schema_definition")
Beispiel #10
0
def role(id, title, description='', local=True):
    register_configuration(
        get_caller_module(),
        dict(
            id=id,
            title=title,
            description=description,
            local=local),
        'role')
Beispiel #11
0
def grant(principal=None, role=None, permission=None,
          permissions=None):
    register_configuration(
        get_caller_module(),
        dict(
            principal=principal,
            role=role,
            permission=permission,
            permissions=permissions),
        'grant')
Beispiel #12
0
def json_schema_definition(name: str, schema: dict) -> None:
    '''
    Register a json schema definition

    :param name: Name of schema
    :param schema: schema definition, must be json compatible
    '''
    register_configuration(
        get_caller_module(),
        dict(name=name, schema=schema),
        'json_schema_definition')
Beispiel #13
0
def json_schema_definition(name, schema):
    register_configuration(get_caller_module(), dict(name=name, schema=schema),
                           'json_schema_definition')