Ejemplo n.º 1
0
class Auditor(object):
    def __init__(self, context, siteInfo):
        self.siteInfo = siteInfo
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, adminInfo, groupInfo=None, instanceDatum='',
             supplementaryDatum=''):
        d = now()
        eventId = to_id(to_unicode_or_bust(adminInfo.id)
                        + unicode(d)
                        + unicode(SystemRandom().randint(0, 1024))
                        + to_unicode_or_bust(adminInfo.name)
                        + to_unicode_or_bust(self.siteInfo.id)
                        + to_unicode_or_bust(self.siteInfo.name)
                        + to_unicode_or_bust(code)
                        + to_unicode_or_bust(instanceDatum)
                        + to_unicode_or_bust(supplementaryDatum))

        e = self.factory(self.context, eventId, code, d, adminInfo, None,
                         self.siteInfo, groupInfo, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 2
0
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo
        self.userInfo = createObject('groupserver.UserFromId', context, '')
        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()
Ejemplo n.º 3
0
    def __init__(self, page):
        """Create an edit auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "page"    A IGSContentFolder representing the page being
                      edited.

        SIDE EFFECTS
            The page is set to the page that is passed in, and used
            as the context for the auditor.

            The user (who is acting on the page) is set after
            determining the logged-in user, using the page as the
            context.

            The site that all this is occurring on is set, after
            being determined by a similar mechanism to the user.

            A page-edit audit event factory is instantiated.
        """
        self.page = page
        self.userInfo = createObject('groupserver.LoggedInUser', page)
        self.siteInfo = createObject('groupserver.SiteInfo', page)

        self.queries = AuditQuery()

        self.factory = EditPageAuditEventFactory()
Ejemplo n.º 4
0
    def __init__(self, siteInfo, groupInfo, adminInfo):
        self.siteInfo = siteInfo
        self.groupInfo = groupInfo
        self.adminInfo = adminInfo

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()
Ejemplo n.º 5
0
    def __init__(self, siteInfo, userInfo):
        self.siteInfo = siteInfo
        self.userInfo = userInfo

        self.queries = AuditQuery()

        self.factory = AuditEventFactory()
Ejemplo n.º 6
0
class Auditor(object):
    def __init__(self, siteInfo, userInfo):
        self.siteInfo = siteInfo
        self.userInfo = userInfo

        self.queries = AuditQuery()

        self.factory = AuditEventFactory()

    def info(self,
             code,
             groupInfo,
             adminInfo,
             instanceDatum='',
             supplementaryDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(adminInfo, self.userInfo, self.siteInfo,
                                     code, instanceDatum, supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d, adminInfo,
                         self.userInfo, self.siteInfo, groupInfo,
                         instanceDatum, supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 7
0
class Auditor(object):
    def __init__(self, siteInfo, user):
        if not siteInfo:
            m = 'No siteInfo'
            raise ValueError(m)
        self.siteInfo = siteInfo

        if not user:
            m = 'No userInfo'
            raise ValueError(m)
        if IGSUserInfo.providedBy(user):
            self.userInfo = user
        else:
            self.userInfo = IGSUserInfo(user)

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = datetime.now(UTC)
        iD = to_ascii(instanceDatum)
        sD = to_ascii(supplementaryDatum)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, iD, sD)

        e = self.factory(self.userInfo.user, eventId, code, d,
                         self.userInfo, None, self.siteInfo, None,
                         instanceDatum, supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 8
0
    def __init__(self, site):
        self.site = site
        self.userInfo = createObject('groupserver.LoggedInUser', site)
        self.siteInfo = createObject('groupserver.SiteInfo', site)
        self.queries = AuditQuery()

        self.factory = ChangeAuditEventFactory()
    def __init__(self, user):
        self.user = user
        self.userInfo = createObject('groupserver.LoggedInUser', user)
        self.instanceUserInfo = IGSUserInfo(user)
        self.siteInfo = createObject('groupserver.SiteInfo', user)

        self.queries = AuditQuery()
        self.factory = CustomUserAuditEventFactory()
    def __init__(self, context):
        """Create a user-creation auditor (after the act).
        """
        self.context = context
        self.userInfo = createObject('groupserver.LoggedInUser', context)
        self.siteInfo = createObject('groupserver.SiteInfo', context)
        self.groupInfo = createObject('groupserver.GroupInfo', context)

        self.queries = AuditQuery()

        self.factory = WebPostAuditEventFactory()
Ejemplo n.º 11
0
    def __init__(self, context, userInfo, groupInfo, siteInfo):
        """Create a bounce-handling auditor (after the act).
        """
        self.context = context
        self.userInfo = userInfo
        self.groupInfo = groupInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = BounceHandlingAuditEventFactory()
class WebPostAuditor(object):
    """An Auditor for ABEL findoc storage

    DESCRIPTION
        This auditor creates an audit trail for the ABEL findoc storage
        subsystem. The work of creating the actual events is then
        carried out by "FindocStorageAuditEventFactory".
    """
    def __init__(self, context):
        """Create a user-creation auditor (after the act).
        """
        self.context = context
        self.userInfo = createObject('groupserver.LoggedInUser', context)
        self.siteInfo = createObject('groupserver.SiteInfo', context)
        self.groupInfo = createObject('groupserver.GroupInfo', context)

        self.queries = AuditQuery()

        self.factory = WebPostAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail.

        ARGUMENTS
            "code"    The code that identifies the event.

            "instanceDatum"
                      Data about the event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.context, eventId, code, d, self.userInfo, None,
                         self.siteInfo, self.groupInfo, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 13
0
class BounceHandlingAuditor(object):
    """An Auditor for GroupServer

    DESCRIPTION
        This auditor creates an audit trail for the handling of
        email bounces. The work of creating the actual events is
        then carried out by "BounceHandlingAuditEventFactory".
    """
    def __init__(self, context, userInfo, groupInfo, siteInfo):
        """Create a bounce-handling auditor (after the act).
        """
        self.context = context
        self.userInfo = userInfo
        self.groupInfo = groupInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = BounceHandlingAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail.

        ARGUMENTS
            "code"    The code that identifies the event.

            "instanceDatum"
                      Data about the event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo,
          self.userInfo, self.siteInfo, code, instanceDatum,
          supplementaryDatum)

        e = self.factory(self.context, eventId, code, d,
          None, self.userInfo, self.siteInfo, self.groupInfo,
          instanceDatum, supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
class WebPostAuditor(object):
    """An Auditor for ABEL findoc storage

    DESCRIPTION
        This auditor creates an audit trail for the ABEL findoc storage
        subsystem. The work of creating the actual events is then
        carried out by "FindocStorageAuditEventFactory".
    """
    def __init__(self, context):
        """Create a user-creation auditor (after the act).
        """
        self.context = context
        self.userInfo = createObject('groupserver.LoggedInUser', context)
        self.siteInfo = createObject('groupserver.SiteInfo', context)
        self.groupInfo = createObject('groupserver.GroupInfo', context)

        self.queries = AuditQuery()

        self.factory = WebPostAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail.

        ARGUMENTS
            "code"    The code that identifies the event.

            "instanceDatum"
                      Data about the event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.context, eventId, code, d, self.userInfo,
                         None, self.siteInfo, self.groupInfo, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 15
0
class BounceHandlingAuditor(object):
    """An Auditor for GroupServer

    DESCRIPTION
        This auditor creates an audit trail for the handling of
        email bounces. The work of creating the actual events is
        then carried out by "BounceHandlingAuditEventFactory".
    """
    def __init__(self, context, userInfo, groupInfo, siteInfo):
        """Create a bounce-handling auditor (after the act).
        """
        self.context = context
        self.userInfo = userInfo
        self.groupInfo = groupInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = BounceHandlingAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail.

        ARGUMENTS
            "code"    The code that identifies the event.

            "instanceDatum"
                      Data about the event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.context, eventId, code, d, None, self.userInfo,
                         self.siteInfo, self.groupInfo, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 16
0
    def __init__(self, page):
        """Create an edit auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "page"    A IGSContentFolder representing the page being
                      edited.

        SIDE EFFECTS
            The page is set to the page that is passed in, and used
            as the context for the auditor.

            The user (who is acting on the page) is set after
            determining the logged-in user, using the page as the
            context.

            The site that all this is occurring on is set, after
            being determined by a similar mechanism to the user.

            A page-edit audit event factory is instantiated.
        """
        self.page = page
        self.userInfo = createObject('groupserver.LoggedInUser', page)
        self.siteInfo = createObject('groupserver.SiteInfo', page)

        self.queries = AuditQuery()

        self.factory = EditPageAuditEventFactory()
Ejemplo n.º 17
0
    def __init__(self, siteInfo, userInfo):
        self.siteInfo = siteInfo
        self.userInfo = userInfo

        self.queries = AuditQuery()

        self.factory = AuditEventFactory()
Ejemplo n.º 18
0
    def __init__(self, siteInfo, user):
        if not siteInfo:
            m = 'No siteInfo'
            raise ValueError(m)
        self.siteInfo = siteInfo

        if not user:
            m = 'No userInfo'
            raise ValueError(m)
        if IGSUserInfo.providedBy(user):
            self.userInfo = user
        else:
            self.userInfo = IGSUserInfo(user)

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()
Ejemplo n.º 19
0
    def __init__(self, site):
        self.site = site
        self.userInfo = createObject('groupserver.LoggedInUser', site)
        self.siteInfo = createObject('groupserver.SiteInfo', site)
        self.queries = AuditQuery()

        self.factory = ChangeAuditEventFactory()
Ejemplo n.º 20
0
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo
        self.userInfo = createObject('groupserver.UserFromId',
          context, '')
        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()
Ejemplo n.º 21
0
class Auditor(object):
    def __init__(self, context):
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, recipientUserInfo=None, instanceDatum=''):
        d = datetime.now(UTC)
        s = code + repr(recipientUserInfo) + instanceDatum + d.isoformat()
        eventId = to_id(s)

        e = self.factory(self.context, eventId, code, d, None,
                         recipientUserInfo, None, None, instanceDatum, None,
                         SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 22
0
class Auditor(object):
    def __init__(self, context):
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, recipientUserInfo=None, instanceDatum=''):
        d = datetime.now(UTC)
        s = code + repr(recipientUserInfo) + instanceDatum + d.isoformat()
        eventId = to_id(s)

        e = self.factory(
            self.context, eventId, code, d, None, recipientUserInfo, None,
            None, instanceDatum, None, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
    def __init__(self, user):
        self.user = user
        self.userInfo = createObject('groupserver.LoggedInUser', user)
        self.instanceUserInfo = IGSUserInfo(user)
        self.siteInfo = createObject('groupserver.SiteInfo', user)

        self.queries = AuditQuery()
        self.factory = CustomUserAuditEventFactory()
Ejemplo n.º 24
0
    def __init__(self, siteInfo, groupInfo, adminInfo, userInfo):
        self.siteInfo = siteInfo
        self.groupInfo = groupInfo
        self.adminInfo = adminInfo
        self.userInfo = userInfo

        self.queries = AuditQuery()

        self.factory = AuditEventFactory()
Ejemplo n.º 25
0
 def __init__(self, userInfo, loggedInUserInfo, siteInfo):
     # --=mpj17=-- This is not a bug: what the audit-trail considers the
     # "user" is the person that is logged in. The "instance user" is the
     # person that is being acted on.
     self.userInfo = loggedInUserInfo
     self.instanceUserInfo = userInfo
     self.siteInfo = siteInfo
     self.queries = AuditQuery()
     self.factory = AuditEventFactory()
Ejemplo n.º 26
0
class Auditor(object):
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, instanceDatum=''):
        d = curr_time()
        eventId = to_id(code, instanceDatum)

        e = self.factory(self.context, eventId, code, d,
                         None, None, self.siteInfo, None,
                         instanceDatum, None, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 27
0
class Auditer(object):
    def __init__(self, userInfo, loggedInUserInfo, siteInfo):
        # --=mpj17=-- This is not a bug: what the audit-trail considers the
        # "user" is the person that is logged in. The "instance user" is the
        # person that is being acted on.
        self.userInfo = loggedInUserInfo
        self.instanceUserInfo = userInfo
        self.siteInfo = siteInfo
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.instanceUserInfo, self.siteInfo, code,
                                     instanceDatum, supplementaryDatum)
        e = self.factory(self.userInfo.user, eventId, code, d, self.userInfo, self.instanceUserInfo,
                         self.siteInfo, None, instanceDatum, supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 28
0
class SiteMemberAuditor(object):
    def __init__(self, context, userInfo, siteInfo):
        self.context = context
        self.userInfo = userInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, '', str(d))

        e = self.factory(self.context, eventId, code, d, self.userInfo, None,
                         self.siteInfo, None, '', None, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 29
0
class Auditor(object):
    def __init__(self, context, siteInfo):
        self.siteInfo = siteInfo
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, userInfo='', instanceDatum='', supplementaryDatum=''):
        d = datetime.now(UTC)
        i = userInfo and userInfo or self.siteInfo
        eventId = event_id_from_data(i, i, self.siteInfo, code,
                    instanceDatum, supplementaryDatum)

        e = self.factory(self.context, eventId, code, d, userInfo, userInfo,
                self.siteInfo, None, instanceDatum, supplementaryDatum,
                SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 30
0
class ChangeAuditor(object):
    def __init__(self, site):
        self.site = site
        self.userInfo = createObject('groupserver.LoggedInUser', site)
        self.siteInfo = createObject('groupserver.SiteInfo', site)
        self.queries = AuditQuery()

        self.factory = ChangeAuditEventFactory()

    def info(self, code, instanceDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum, '')

        e = self.factory(self.site, eventId, code, d, self.userInfo, None,
                         self.siteInfo, None, instanceDatum, None, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
    def __init__(self, context):
        """Create a user-creation auditor (after the act).
        """
        self.context = context
        self.userInfo = createObject('groupserver.LoggedInUser', context)
        self.siteInfo = createObject('groupserver.SiteInfo', context)
        self.groupInfo = createObject('groupserver.GroupInfo', context)

        self.queries = AuditQuery()

        self.factory = WebPostAuditEventFactory()
class foo(object):
    def __init__(self, user):
        self.user = user
        self.userInfo = createObject('groupserver.LoggedInUser', user)
        self.instanceUserInfo = IGSUserInfo(user)
        self.siteInfo = createObject('groupserver.SiteInfo', user)

        self.queries = AuditQuery()
        self.factory = CustomUserAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = date.today()
        eventId = event_id_from_data(self.userInfo,
          self.instanceUserInfo, self.siteInfo, code, instanceDatum,
          supplementaryDatum)
        e = self.factory(self.user, eventId, code, d,
          self.userInfo, self.instanceUserInfo, self.siteInfo,
          instanceDatum, supplementaryDatum)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 33
0
class SiteMemberAuditor(object):
    def __init__(self, context, userInfo, siteInfo):
        self.context = context
        self.userInfo = userInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
            self.siteInfo, code, '', str(d))

        e = self.factory(self.context, eventId, code, d,
                self.userInfo, None, self.siteInfo, None,
                '', None, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 34
0
class ChangeAuditor(object):
    def __init__(self, site):
        self.site = site
        self.userInfo = createObject('groupserver.LoggedInUser', site)
        self.siteInfo = createObject('groupserver.SiteInfo', site)
        self.queries = AuditQuery()

        self.factory = ChangeAuditEventFactory()

    def info(self, code, instanceDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum, '')

        e = self.factory(self.site, eventId, code, d, self.userInfo,
                         None, self.siteInfo, None, instanceDatum, None,
                         SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 35
0
    def __init__(self, context, userInfo, groupInfo, siteInfo):
        """Create a bounce-handling auditor (after the act).
        """
        self.context = context
        self.userInfo = userInfo
        self.groupInfo = groupInfo
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = BounceHandlingAuditEventFactory()
class foo(object):
    def __init__(self, user):
        self.user = user
        self.userInfo = createObject('groupserver.LoggedInUser', user)
        self.instanceUserInfo = IGSUserInfo(user)
        self.siteInfo = createObject('groupserver.SiteInfo', user)

        self.queries = AuditQuery()
        self.factory = CustomUserAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = date.today()
        eventId = event_id_from_data(self.userInfo, self.instanceUserInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)
        e = self.factory(self.user, eventId, code, d, self.userInfo,
                         self.instanceUserInfo, self.siteInfo, instanceDatum,
                         supplementaryDatum)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 37
0
class AnonLoginAuditor(object):
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo
        self.userInfo = createObject('groupserver.UserFromId',
          context, '')
        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
          self.siteInfo, code, instanceDatum, supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d, self.userInfo,
                            None, self.siteInfo, None, instanceDatum,
                            supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 38
0
class Auditor(object):
    def __init__(self, siteInfo, userInfo):
        self.siteInfo = siteInfo
        self.userInfo = userInfo

        self.queries = AuditQuery()

        self.factory = AuditEventFactory()

    def info(self, code, groupInfo, adminInfo, instanceDatum='',
                supplementaryDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(adminInfo, self.userInfo,
            self.siteInfo, code, instanceDatum, supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d, adminInfo,
                self.userInfo, self.siteInfo, groupInfo, instanceDatum,
                supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 39
0
class AnonLoginAuditor(object):
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo
        self.userInfo = createObject('groupserver.UserFromId', context, '')
        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d, self.userInfo,
                         None, self.siteInfo, None, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 40
0
    def __init__(self, siteInfo, user):
        """Create an login auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "userInfo"
            "siteInfo"

        SIDE EFFECTS
        """
        self.user = user
        self.userInfo = IGSUserInfo(user)
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()
Ejemplo n.º 41
0
class Auditor(object):
    def __init__(self, context, siteInfo):
        self.siteInfo = siteInfo
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()
        
    def info(self, code, instanceUserInfo='', instanceDatum = '', 
                supplementaryDatum = ''):
        d = datetime.now(UTC)
        userInfo = createObject('groupserver.LoggedInUser', self.context)
        instanceUserInfo = instanceUserInfo and instanceUserInfo or userInfo 
        eventId = event_id_from_data(userInfo, instanceUserInfo, 
                    self.siteInfo, code,
                    instanceDatum, supplementaryDatum)
          
        e = self.factory(self.context, eventId,  code, d, 
                userInfo, instanceUserInfo, self.siteInfo, None,
                instanceDatum, supplementaryDatum, SUBSYSTEM)
          
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 42
0
class Auditor(object):
    def __init__(self, context, siteInfo):
        self.siteInfo = siteInfo
        self.context = context
        self.queries = AuditQuery()
        self.factory = AuditEventFactory()

    def info(self, code, instanceUserInfo='', instanceDatum='',
             supplementaryDatum=''):
        d = datetime.now(UTC)
        userInfo = createObject('groupserver.LoggedInUser', self.context)
        instanceUserInfo = instanceUserInfo and instanceUserInfo or userInfo
        eventId = event_id_from_data(
            userInfo, instanceUserInfo, self.siteInfo, code, instanceDatum,
            supplementaryDatum)

        e = self.factory(
            self.context, eventId, code, d, userInfo, instanceUserInfo,
            self.siteInfo, None, instanceDatum, supplementaryDatum,
            SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 43
0
class ProfileAuditer(object):
    def __init__(self, user):
        self.user = user
        self.userInfo = createObject('groupserver.LoggedInUser',user)
        self.instanceUserInfo = IGSUserInfo(user)
        self.siteInfo = createObject('groupserver.SiteInfo', user)

        self.queries = AuditQuery()

        self.factory = ProfileAuditEventFactory()

    def info(self, code, instanceDatum = '', supplementaryDatum = ''):
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo,
          self.instanceUserInfo, self.siteInfo, code, instanceDatum,
          supplementaryDatum)

        e =  self.factory(self.user, eventId,  code, d,
          self.userInfo, self.instanceUserInfo, self.siteInfo, None,
          instanceDatum, supplementaryDatum, SUBSYSTEM)

        self.queries.store(e)
        log.info(e)
Ejemplo n.º 44
0
    def __init__(self, siteInfo, user):
        """Create an login auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "userInfo"
            "siteInfo"

        SIDE EFFECTS
        """
        self.user = user
        self.userInfo = IGSUserInfo(user)
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()
Ejemplo n.º 45
0
class PageEditAuditor(object):
    """An Auditor for Page Editor

    DESCRIPTION
        An auditor (sometimes called an auditer) creates an audit
        trail for a specific subsystem. In this case enrolment. The
        work of creating the actual events is carried out by the
        audit-event factory
    """
    def __init__(self, page):
        """Create an edit auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "page"    A IGSContentFolder representing the page being
                      edited.

        SIDE EFFECTS
            The page is set to the page that is passed in, and used
            as the context for the auditor.

            The user (who is acting on the page) is set after
            determining the logged-in user, using the page as the
            context.

            The site that all this is occurring on is set, after
            being determined by a similar mechanism to the user.

            A page-edit audit event factory is instantiated.
        """
        self.page = page
        self.userInfo = createObject('groupserver.LoggedInUser', page)
        self.siteInfo = createObject('groupserver.SiteInfo', page)

        self.queries = AuditQuery()

        self.factory = EditPageAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail. It is
            named after the equivalent method in the standard Python
            logger, which it also writes to.

        ARGUMENTS
            "code"    The code that identifies the event that is
                      logged. Sometimes this is enough.
            "instanceDatum" The data to write as the instance datum
                      for the event. Defaults to an empty string.
                      (See below.)
            "supplementaryDatum" The data to write as the
                    supplementary datum for the event. Defaults to
                    an empty string. (See below.)

            If the instance datum *and* the supplementary datum are
            set to empty strings then they are set to the page URL
            and page title respectively.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        if ((not instanceDatum) and (not supplementaryDatum)):
            instanceDatum = self.page.absolute_url(0)
            supplementaryDatum = self.page.title_or_id()
        eventId = event_id_from_data(self.userInfo, self.userInfo,
          self.siteInfo, code, instanceDatum, supplementaryDatum)

        e = self.factory(self.page, eventId, code, d,
          self.userInfo, None, self.siteInfo, None,
          instanceDatum, supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 46
0
class PageEditAuditor(object):
    """An Auditor for Page Editor

    DESCRIPTION
        An auditor (sometimes called an auditer) creates an audit
        trail for a specific subsystem. In this case enrolment. The
        work of creating the actual events is carried out by the
        audit-event factory
    """
    def __init__(self, page):
        """Create an edit auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "page"    A IGSContentFolder representing the page being
                      edited.

        SIDE EFFECTS
            The page is set to the page that is passed in, and used
            as the context for the auditor.

            The user (who is acting on the page) is set after
            determining the logged-in user, using the page as the
            context.

            The site that all this is occurring on is set, after
            being determined by a similar mechanism to the user.

            A page-edit audit event factory is instantiated.
        """
        self.page = page
        self.userInfo = createObject('groupserver.LoggedInUser', page)
        self.siteInfo = createObject('groupserver.SiteInfo', page)

        self.queries = AuditQuery()

        self.factory = EditPageAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail. It is
            named after the equivalent method in the standard Python
            logger, which it also writes to.

        ARGUMENTS
            "code"    The code that identifies the event that is
                      logged. Sometimes this is enough.
            "instanceDatum" The data to write as the instance datum
                      for the event. Defaults to an empty string.
                      (See below.)
            "supplementaryDatum" The data to write as the
                    supplementary datum for the event. Defaults to
                    an empty string. (See below.)

            If the instance datum *and* the supplementary datum are
            set to empty strings then they are set to the page URL
            and page title respectively.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        if ((not instanceDatum) and (not supplementaryDatum)):
            instanceDatum = self.page.absolute_url(0)
            supplementaryDatum = self.page.title_or_id()
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.page, eventId, code, d, self.userInfo, None,
                         self.siteInfo, None, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 47
0
    def __init__(self, context, siteInfo):
        self.context = context
        self.siteInfo = siteInfo

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()
Ejemplo n.º 48
0
 def queries(self):
     retval = AuditQuery()
     return retval
Ejemplo n.º 49
0
 def __init__(self, context):
     self.context = context
     self.queries = AuditQuery()
     self.factory = AuditEventFactory()
Ejemplo n.º 50
0
 def __init__(self, context):
     self.context = context
     self.queries = AuditQuery()
     self.factory = AuditEventFactory()
Ejemplo n.º 51
0
 def __init__(self, context, siteInfo):
     self.siteInfo = siteInfo
     self.context = context
     self.queries = AuditQuery()
     self.factory = AuditEventFactory()
Ejemplo n.º 52
0
class LoginAuditor(object):
    """An Auditor for Login

    DESCRIPTION
        An auditor (sometimes called an auditer) creates an audit
        trail for a specific subsystem. In this case login. The
        work of creating the actual events is carried out by the
        audit-event factory, in this case "LoginAuditEventFactory".
        Every subsystem will (should) have its own auditor.
    """
    def __init__(self, siteInfo, user):
        """Create an login auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "userInfo"
            "siteInfo"

        SIDE EFFECTS
        """
        self.user = user
        self.userInfo = IGSUserInfo(user)
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail. It is
            named after the equivalent method in the standard Python
            logger, which it also writes to. The three arguments
            (other than self) are combined to form the arguments to
            the factory, which creates the event that is then
            recorded.

        ARGUMENTS
            "code"    The code that identifies the event that is
                      logged. Sometimes this is enough.

            "instanceDatum"
                      Data about the event. Each event class has its
                      own way to interpret this data.

            "supplementaryDatum"
                      More data about an event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
          self.siteInfo, code, instanceDatum, supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d,
                          self.userInfo, None, self.siteInfo, None,
                          instanceDatum, supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)
Ejemplo n.º 53
0
 def queries(self):
     if self.__queries == None:
         self.__queries = AuditQuery()
     return self.__queries
Ejemplo n.º 54
0
class LoginAuditor(object):
    """An Auditor for Login

    DESCRIPTION
        An auditor (sometimes called an auditer) creates an audit
        trail for a specific subsystem. In this case login. The
        work of creating the actual events is carried out by the
        audit-event factory, in this case "LoginAuditEventFactory".
        Every subsystem will (should) have its own auditor.
    """
    def __init__(self, siteInfo, user):
        """Create an login auditor.

        DESCRIPTION
            The constructor for an auditor is passed all the data
            that will be the same for the events that are created
            during one use of the auditor by a Zope 3 page-view.

        ARGUMENTS
            "userInfo"
            "siteInfo"

        SIDE EFFECTS
        """
        self.user = user
        self.userInfo = IGSUserInfo(user)
        self.siteInfo = siteInfo

        self.queries = AuditQuery()

        self.factory = LoginAuditEventFactory()

    def info(self, code, instanceDatum='', supplementaryDatum=''):
        """Log an info event to the audit trail.

        DESCRIPTION
            This method logs an event to the audit trail. It is
            named after the equivalent method in the standard Python
            logger, which it also writes to. The three arguments
            (other than self) are combined to form the arguments to
            the factory, which creates the event that is then
            recorded.

        ARGUMENTS
            "code"    The code that identifies the event that is
                      logged. Sometimes this is enough.

            "instanceDatum"
                      Data about the event. Each event class has its
                      own way to interpret this data.

            "supplementaryDatum"
                      More data about an event.

        SIDE EFFECTS
            * Creates an ID for the new event,
            * Writes the instantiated event to the audit-table, and
            * Writes the event to the standard Python log.

        RETURNS
            None
        """
        d = datetime.now(UTC)
        eventId = event_id_from_data(self.userInfo, self.userInfo,
                                     self.siteInfo, code, instanceDatum,
                                     supplementaryDatum)

        e = self.factory(self.userInfo.user, eventId, code, d, self.userInfo,
                         None, self.siteInfo, None, instanceDatum,
                         supplementaryDatum, SUBSYSTEM)
        self.queries.store(e)
        log.info(e)