ZODB Components: Migrate source files related to erp5_base.
-
Owner
I tried to update an instance where the only user I have is a person from person module, with manager role set added with
acl_users/zodb_roles
. In this case, it's impossible to login with the person before upgrade, because person is broken.But I don't see how we can support this scenario, it's not really important because zodb login works fine and also I don't see how we can implement this except by partially reverting this change or doing some kind of implicit upgrade at startup.
For the records, I worked around by making a local change somewhere in ERP5 code to add
import pdb; pdb.set_trace()
( I actually usedindex 2e00d8bddd..4833e67d37 100644 --- a/product/ERP5Security/ERP5LoginUserManager.py +++ b/product/ERP5Security/ERP5LoginUserManager.py @@ -77,6 +77,7 @@ class ERP5LoginUserManager(BasePlugin): # security.declarePrivate('authenticateCredentials') def authenticateCredentials(self, credentials): + import pdb; pdb.set_trace() login_portal_type = credentials.get( 'login_portal_type', self.login_portal_type,
)
then stopped zope from slapos and started in foreground so that I can interact with pdb:
slapos node stop slappart5: /srv/slapgrid/slappart12/srv/slapos/inst/slappart5/etc/service/zope-0
try to login from the web interface, this hits my pdb breakpoint and I use zope API to add an emergency user:
... (Pdb) self.acl_users._doAddUser('login', 'password', ['Manager',], [])
Then I can login as this user and start the actual upgrade.
Maybe what we need is as an easier way to add a zodb login from slapos (similar to the old
zopectl adduser login password
), I know this trick well because I used it several times already.