def activateSearchable(self):
        registry = getUtility(IRegistry)
        prefix = 'plone.app.querystring.field.' + self.field_name

        def add(name, value):
            registry.records[prefix + '.' + name] = value

        add('title', Record(field.TextLine(), safe_unicode(self.field_title)))
        add('enabled', Record(field.Bool(), True))
        add('group', Record(field.TextLine(), safe_unicode('Taxonomy')))
        add('operations', Record(field.List(value_type=field.TextLine()),
            [u'plone.app.querystring.operation.selection.is']))
        add('vocabulary', Record(field.TextLine(), safe_unicode(self.vocabulary_name)))  # noqa: E501
        add('sortable', Record(field.Bool(), False))
        add('description', Record(field.Text(), safe_unicode('')))
Esempio n. 2
0
def add_cookie_policy(context):
    registry = getUtility(IRegistry)
    records = registry.records
    if "imio.gdpr.interfaces.IGDPRSettings.cookies_text" in records:
        return
    record = Record(
        field.Text(
            title=_("title_cookies_text", default="Cookies text"),
            description=_("help_cookies_text",
                          default="The text of the Cookies Policy page."),
            required=True,
        ),
        value=get_default_cookies_text(context),
    )
    records["imio.gdpr.interfaces.IGDPRSettings.cookies_text"] = record
Esempio n. 3
0
def upgrade(context, logger=None):
    setup = getToolByName(context, 'portal_setup')
    setup.runAllImportStepsFromProfile(PROFILE_ID)
    try:
        auth_step_timeout = api.portal.get_registry_record(
            name='plone.auth_step_timeout', default=None)
    except api.exc.InvalidParameterError:
        auth_step_timeout = None

    if not auth_step_timeout:
        registry = getUtility(IRegistry)
        auth_timeout_field = field.Int(
            title=u"(Seconds) This amount of inactivity \
                                                will reset the login process",
            description=u"Between each step, the allowed \
                                                     time is reset to this amount",
            default=120)
        auth_timeout_record = Record(auth_timeout_field)
        registry._records['plone.auth_step_timeout'] = auth_timeout_record

    try:
        disclaimer = api.portal.get_registry_record(
            name='castle.show_disclaimer', default=None)
    except api.exc.InvalidParameterError:
        disclaimer = None

    if not disclaimer:
        registry = getUtility(IRegistry)
        show_disclaimer_field = field.Bool(
            title=u'Show disclaimer for first time a user visits a site. '
            u'To comply with ePrivacy Directive, use this feature to notify about cookie use.',
            default=False,
            required=False)
        site_disclaimer_field = field.Text(
            title=u"Disclaimer",
            default=u'<p><strong>Disclaimer</strong> '
            u'<em>You are seeing this because this is your first time visiting the site.</em></p>',
            required=False)
        show_disclaimer_record = Record(show_disclaimer_field)
        site_disclaimer_record = Record(site_disclaimer_field)
        registry._records['castle.show_disclaimer'] = show_disclaimer_record
        registry._records['castle.site_disclaimer'] = site_disclaimer_record
    transaction.commit()

    update_password_expiry(api.portal.get())

    for id in context.objectIds():
        context[id].reindexObject(idxs=['has_private_parents'])
Esempio n. 4
0
def addIndexedTaxonomiesToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records

    if 'cpskin.core.interfaces.ICPSkinSettings.indexed_taxonomies' in records:  # noqa
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.indexed_taxonomies to registry'
    )  # noqa
    record = Record(field.Text(
        title=_(u'Taxonomies to index'),
        description=_(
            u'List of taxonomy IDs (one per line) that should be indexed.'),
        required=False,
        default=u'types_activites\n'),
                    value=u'types_activites\n')
    records[
        'cpskin.core.interfaces.ICPSkinSettings.indexed_taxonomies'] = record
Esempio n. 5
0
    def activateSearchable(self):
        registry = getUtility(IRegistry)
        prefix = "plone.app.querystring.field." + self.field_name

        def add(name, value):
            registry.records[prefix + "." + name] = value

        add("title", Record(field.TextLine(), safe_unicode(self.field_title)))
        add("enabled", Record(field.Bool(), True))
        add("group", Record(field.TextLine(), safe_unicode("Taxonomy")))
        add(
            "operations",
            Record(
                field.List(value_type=field.TextLine()),
                [u"plone.app.querystring.operation.selection.is"],
            ),
        )
        add(
            "vocabulary", Record(field.TextLine(), safe_unicode(self.vocabulary_name))
        )  # noqa: E501
        add("sortable", Record(field.Bool(), False))
        add("description", Record(field.Text(), safe_unicode("")))
Esempio n. 6
0
def upgrade(context, logger=None):
    setup = getToolByName(context, 'portal_setup')
    setup.runAllImportStepsFromProfile(PROFILE_ID)
    registry = getUtility(IRegistry)
    try:
        auth_step_timeout = api.portal.get_registry_record(name='plone.auth_step_timeout', default=None)
    except api.exc.InvalidParameterError:
        auth_step_timeout = None

    if not auth_step_timeout:
        auth_timeout_field = field.Int(title=u"(Seconds) This amount of inactivity \
                                                will reset the login process",
                                       description=u"Between each step, the allowed \
                                                     time is reset to this amount",
                                       default=120)
        auth_timeout_record = Record(auth_timeout_field)
        registry._records['plone.auth_step_timeout'] = auth_timeout_record

    try:
        disclaimer = api.portal.get_registry_record(name='castle.show_disclaimer', default=None)
    except api.exc.InvalidParameterError:
        disclaimer = None

    if not disclaimer:
        show_disclaimer_field = field.Bool(
            title=u'Show disclaimer for first time a user visits a site. '
                  u'To comply with ePrivacy Directive, use this feature to notify about cookie use.',
            default=False,
            required=False)
        site_disclaimer_field = field.Text(
            title=u"Disclaimer",
            default=u'<p><strong>Disclaimer</strong> '
                    u'<em>You are seeing this because this is your first time visiting the site.</em></p>',
            required=False)
        show_disclaimer_record = Record(show_disclaimer_field)
        site_disclaimer_record = Record(site_disclaimer_field)
        registry._records['castle.show_disclaimer'] = show_disclaimer_record
        registry._records['castle.site_disclaimer'] = site_disclaimer_record

    update_password_expiry(api.portal.get())

    for id in context.objectIds():
        context[id].reindexObject(idxs=['has_private_parents'])

    try:
        scrub_site_identity = api.portal.get_registry_record(name='plone.scrub_title_logo_to_backend_login',
                                                             default=None)
    except api.exc.InvalidParameterError:
        scrub_site_identity = None

    if not scrub_site_identity:
        scrub_identity_field = field.Bool(
            title=u'Do not show identifying customizations (logo/text) at backend login view',
            description=u'If set, backend visitors will see a generic login view.',
            default=False,
            required=False)
        scrub_identity_record = Record(scrub_identity_field)
        registry._records['plone.scrub_title_logo_to_backend_login'] = scrub_identity_record

    try:
        login_footer_message = api.portal.get_registry_record(name='plone.scrub_title_logo_to_backend_login',
                                                              default=None)
    except api.exc.InvalidParameterError:
        login_footer_message = None

    if not login_footer_message:
        login_footer_message_field = field.TextLine(
            title=u'Login Footer Message',
            description=u'Display a message or warning below the secure login form',
            required=False)
        login_footer_message_record = Record(login_footer_message_field)
        registry._records['plone.login_footer_message'] = login_footer_message_record