Exemplo n.º 1
0
def logged_in(event):
    context = event.request.context  # event.context may be HTTPForbidden
    log = get_auditlog(context)
    if log is None:
        return
    user_oid = get_oid(event.user, None)
    log.add('LoggedIn', None, login=event.login, user_oid=user_oid)
Exemplo n.º 2
0
def logged_in(event):
    context = event.request.context # event.context may be HTTPForbidden
    log = get_auditlog(context)
    if log is None:
        return
    user_oid = get_oid(event.user, None)
    log.add('LoggedIn', None, login=event.login, user_oid=user_oid)
Exemplo n.º 3
0
def auditlog_show(root: IRoot,
                  startdate: datetime=None,
                  endtdate: datetime=None,
                  path: str=None
                  ):
    """Show auditlog entries."""
    auditlog = get_auditlog(root)
    auditlog_entries = list(auditlog.items(min=startdate, max=endtdate))
    filtered_by_path = _filter_by_path(auditlog_entries, path)
    _print_auditlog(filtered_by_path)
Exemplo n.º 4
0
def content_modified(event):
    log = get_auditlog(event.object)
    if log is None:
        return
    userinfo = _get_userinfo()
    oid = get_oid(event.object, None)
    object_path = resource_path(event.object)
    content_type = str(event.registry.content.typeof(event.object))
    log.add(
        'ContentModified',
        oid,
        object_oid=oid,
        object_path=object_path,
        content_type=content_type,
        userinfo=userinfo,
    )
Exemplo n.º 5
0
def content_modified(event):
    log = get_auditlog(event.object)
    if log is None:
        return
    userinfo = _get_userinfo()
    oid = get_oid(event.object, None)
    object_path = resource_path(event.object)
    content_type = str(event.registry.content.typeof(event.object))
    log.add(
        'ContentModified',
        oid,
        object_oid=oid,
        object_path=object_path,
        content_type=content_type,
        userinfo=userinfo,
        )
Exemplo n.º 6
0
def acl_modified(event):
    """ Generates ACLModified audit events """
    log = get_auditlog(event.object)
    if log is None:
        return
    userinfo = _get_userinfo()
    oid = get_oid(event.object, None)
    old_acl = str(event.old_acl)
    new_acl = str(event.new_acl)
    path = resource_path(event.object)
    content_type = str(event.registry.content.typeof(event.object))
    log.add(
        'ACLModified',
        oid,
        object_path=path,
        old_acl=old_acl,
        new_acl=new_acl,
        userinfo=userinfo,
        content_type=content_type,
    )
Exemplo n.º 7
0
def acl_modified(event):
    """ Generates ACLModified audit events """
    log = get_auditlog(event.object)
    if log is None:
        return
    userinfo = _get_userinfo()
    oid = get_oid(event.object, None)
    old_acl = str(event.old_acl)
    new_acl = str(event.new_acl)
    path = resource_path(event.object)
    content_type = str(event.registry.content.typeof(event.object))
    log.add(
        'ACLModified',
        oid,
        object_path=path,
        old_acl=old_acl,
        new_acl=new_acl,
        userinfo=userinfo,
        content_type=content_type,
        )
Exemplo n.º 8
0
def _add_record(event_name, event, objects):
    log = get_auditlog(event.parent)
    if log is None:
        return
    userinfo = _get_userinfo()
    object_name = event.name
    for obj in objects:
        content_type = str(event.registry.content.typeof(obj))
        parent = obj.__parent__
        folder_path = resource_path(parent)
        folder_oid = get_oid(parent, None)
        object_oid = get_oid(obj, None)
        log.add(
            event_name,
            folder_oid,  # this is an event related to the *container*
            object_oid=object_oid,
            folder_oid=folder_oid,
            folder_path=folder_path,
            object_name=object_name,
            content_type=content_type,
            userinfo=userinfo,
        )
Exemplo n.º 9
0
def _add_record(event_name, event, objects):
    log = get_auditlog(event.parent)
    if log is None:
        return
    userinfo = _get_userinfo()
    object_name = event.name
    for obj in objects:
        content_type = str(event.registry.content.typeof(obj))
        parent = obj.__parent__
        folder_path = resource_path(parent)
        folder_oid = get_oid(parent, None)
        object_oid = get_oid(obj, None)
        log.add(
            event_name,
            folder_oid, # this is an event related to the *container*
            object_oid=object_oid,
            folder_oid=folder_oid,
            folder_path=folder_path,
            object_name=object_name,
            content_type=content_type,
            userinfo=userinfo,
            )