collective / collective.saml2

Installation of SAML2 web single-sign-on for Plone (dm.zope.saml2)
5 stars 6 forks source link

How can I remove all ISamlAuthority references? #4

Closed erral closed 6 years ago

erral commented 6 years ago

After testing collective.saml2 and its dependencies, we have decided not to use it, and when I uninstall it from the control panel and remove it from buildout I get AttributeError: type object 'ISamlAuthority' has no attribute '__iro__' errors.

I tried removing it with wildcard.fixpersistentutilities but I had no success.

I tried removing it manually like this, but I had no success:

    from dm.zope.saml2.interfaces import ISamlAuthority
    sm = portal.getSiteManager()
    if ISamlAuthority in sm.utilities._subscribers[0].keys():
        del sm.utilities._subscribers[0][ISamlAuthority]

I tried to do it from an Extensions/Install.py uninstall method and also running an script with instance run but there are still traces of ISamlAuthority on the Data.fs

What am I missing?

thyarles commented 6 years ago

Hi @erral. Please, let me know if you know how to remove references.

erral commented 6 years ago

Following this guide I was able to remove the traces: https://docs.plone.org/manage/troubleshooting/manual-remove-utility.html

Using ./bin/instance debug I run this code to delete it:

productname = 'dm.zope.saml2'

portal = app.Plone # use here your Plone site's id

sm = portal.getSiteManager()

adapters = sm.utilities._adapters
for x in adapters[0].keys():
    if x.__module__.find(productname) != -1:
        print "deleting %s" % x
    del adapters[0][x]

sm.utilities._adapters = adapters

subscribers = sm.utilities._subscribers
for x in subscribers[0].keys():
    if x.__module__.find(productname) != -1:
        print "deleting %s" % x
    del subscribers[0][x]

sm.utilities._subscribers = subscribers

provided = sm.utilities._provided
for x in provided.keys():
    if x.__module__.find(productname) != -1:
        print "deleting %s" % x
    del provided[x]

sm.utilities._provided = provided

from transaction import commit
commit()
app._p_jar.sync()