Skip to content

Commit

Permalink
Add uninstall profile
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Nov 1, 2018
1 parent a9a00f2 commit 50e7494
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 17 deletions.
11 changes: 6 additions & 5 deletions CHANGES.txt → CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
HISTORY of collective.pwexpiry
==============================
Changelog
=========

0.12.1 (unreleased)
-------------------
1.0.0 (unreleased)
------------------

- Nothing changed yet.
- Add uninstall profile and tests.
[hvelarde]


0.12.0 (2018-05-30)
Expand Down
10 changes: 10 additions & 0 deletions collective/pwexpiry/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:registerProfile
name="uninstall"
title="collective.pwexpiry: uninstall"
directory="profiles/uninstall"
description="Uninstalls collective.pwexpiry."
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<utility factory=".setuphandlers.HiddenProfiles" name="collective.pwexpiry" />

<subscriber
for="Products.CMFCore.interfaces.IMemberData
.interfaces.IValidPasswordEntered"
Expand Down
4 changes: 4 additions & 0 deletions collective/pwexpiry/profiles/uninstall/browserlayer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<layers>
<layer remove="true" name="collective.pwexpiry"/>
</layers>
10 changes: 10 additions & 0 deletions collective/pwexpiry/profiles/uninstall/controlpanel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<object name="portal_controlpanel">
<configlet
remove="true"
title="Password expiration"
action_id="pwexpirycontrolpanel"
appId="Pwexpiry"
category="Products"
/>
</object>
9 changes: 9 additions & 0 deletions collective/pwexpiry/profiles/uninstall/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<registry>
<record name="collective.pwexpiry.validity_period" remove="true" />
<record name="collective.pwexpiry.notification_actions" remove="true" />
<record name="collective.pwexpiry.whitelisted_users" remove="true" />
<record name="collective.pwexpiry.allowed_tries" remove="true" />
<record name="collective.pwexpiry.disable_time" remove="true" />
<record name="collective.pwexpiry.password_history_size" remove="true" />
</registry>
11 changes: 11 additions & 0 deletions collective/pwexpiry/profiles/uninstall/skins.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<object name="portal_skins">
<object
remove="true"
name="pwexpiry"
directory="collective.pwexpiry:skins/pwexpiry"
/>
<skin-path name="*">
<layer remove="true" name="pwexpiry" />
</skin-path>
</object>
30 changes: 20 additions & 10 deletions collective/pwexpiry/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# -*- coding: utf-8 -*-
try:
from Products.CMFPlone import __version__ as plone_version
except:
plone_version = '4'

import logging

from collective.pwexpiry.config import IS_PLONE_5
from collective.pwexpiry.pwdisable_plugin import addPwDisablePlugin
from collective.pwexpiry.pwexpiry_plugin import addPwExpiryPlugin
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.interfaces import INonInstallable
from Products.PlonePAS.Extensions.Install import activatePluginInterfaces
from Products.PluggableAuthService.interfaces.plugins import IChallengePlugin
from pwdisable_plugin import addPwDisablePlugin
from pwexpiry_plugin import addPwExpiryPlugin
from zope.interface import implementer

import logging


logger = logging.getLogger('collective.pwexpiry')


@implementer(INonInstallable)
class HiddenProfiles(object): # pragma: no cover

def getNonInstallableProfiles(self):
"""Do not show on Plone's list of installable profiles."""
return [
u'collective.pwexpiry:plone4',
u'collective.pwexpiry:uninstall',
]


def import_various(context):
"""
Install the PwExpiryPlugin
Expand Down Expand Up @@ -43,6 +53,6 @@ def import_various(context):
else:
logger.info('pwdisable already installed')

if plone_version.startswith('4'):
if not IS_PLONE_5:
profile = 'profile-collective.pwexpiry:plone4'
ps.runAllImportStepsFromProfile(profile)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()

version = '0.12.1.dev0'
version = '1.0.0.dev0'

setup(name='collective.pwexpiry',
version=version,
description="Emulate Active Directory password complexity requirements \
in Plone",
long_description=read("README.rst") + "\n" + read("CHANGES.txt"),
long_description=read("README.rst") + "\n" + read("CHANGES.rst"),
classifiers=[
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down

0 comments on commit 50e7494

Please sign in to comment.