コード例 #1
0
def sync_ogds(plone, users=True, groups=True):
    """Syncronize OGDS users and groups by importing users, groups and
    group membership information from LDAP into the respective OGDS SQL tables.

    If none of the `users` or `groups` keyword arguments are supplied, both
    users and groups will be imported. If one is set to false, only the other
    will be imported.

    NOTE: This function does *not* commit the transaction. Depending on from
    where you use it, you'll need to take care of that yourself, if necessary.
    """
    # Set up logging to a rotating ogds-update.log
    setup_ogds_sync_logfile(logger)

    updater = IOGDSUpdater(plone)
    start = time.clock()

    if users:
        logger.info(u"Importing users...")
        updater.import_users()

    if groups:
        logger.info(u"Importing groups...")
        updater.import_groups()

    elapsed = time.clock() - start
    logger.info(u"Done in {:0.1f} seconds.".format(elapsed))

    logger.info(u"Updating LDAP SYNC importstamp...")
    set_remote_import_stamp(plone)

    logger.info(u"Synchronization Done.")
コード例 #2
0
def sync_ogds(plone, users=True, groups=True):
    """Syncronize OGDS users and groups by importing users, groups and
    group membership information from LDAP into the respective OGDS SQL tables.

    If none of the `users` or `groups` keyword arguments are supplied, both
    users and groups will be imported. If one is set to false, only the other
    will be imported.

    NOTE: This function does *not* commit the transaction. Depending on from
    where you use it, you'll need to take care of that yourself, if necessary.
    """

    # Set up logging to a rotating ogds-update.log
    setup_ogds_sync_logfile(logger)

    updater = IOGDSUpdater(plone)
    start = time.clock()

    if users:
        logger.info(u"Importing users...")
        updater.import_users()

    if groups:
        logger.info(u"Importing groups...")
        updater.import_groups()

    elapsed = time.clock() - start
    logger.info(u"Done in {:0.1f} seconds.".format(elapsed))

    logger.info(u"Updating LDAP SYNC importstamp...")
    set_remote_import_stamp(plone)

    logger.info(u"Synchronization Done.")
コード例 #3
0
    def __call__(self):
        set_remote_import_stamp(self.context)
        IStatusMessage(self.context.REQUEST).addStatusMessage(
            u"Successfully reset the Syncstamp on every client", "info")

        url = self.context.REQUEST.environ.get('HTTP_REFERER')
        if not url:
            url = self.context.absolute_url()

        return self.context.REQUEST.RESPONSE.redirect(url)
コード例 #4
0
    def __call__(self):
        set_remote_import_stamp(self.context)
        IStatusMessage(self.context.REQUEST).addStatusMessage(
            u"Successfully reset the Syncstamp on every client", "info")

        url = self.context.REQUEST.environ.get('HTTP_REFERER')
        if not url:
            url = self.context.absolute_url()

        return self.context.REQUEST.RESPONSE.redirect(url)