Skip to content

Commit

Permalink
Merge pull request #8074 from 4teamwork/lg/TI-1456/ogds-sync-user
Browse files Browse the repository at this point in the history
Fix OGDS sync for multi-tenant setups:
  • Loading branch information
lukasgraf committed Oct 28, 2024
1 parent 28e549f commit f2a7a34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/TI-1456.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix OGDS sync for multi-tenant setups. [lgraf]
11 changes: 11 additions & 0 deletions opengever/ogds/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from AccessControl.SecurityManagement import newSecurityManager
from opengever.core.debughelpers import get_first_plone_site
from opengever.core.debughelpers import setup_plone
from opengever.ogds.base.sync.ogds_updater import sync_ogds
Expand All @@ -18,5 +19,15 @@ def sync_ogds_zopectl_handler(app, args):
stream_handler.setLevel(logging.INFO)

plone = setup_plone(get_first_plone_site(app))

# Switch security context to 'zopemaster' instead of SpecialUsers.system.
# This is required because in multi-tenant setups, the OGDS sync will
# dispatch a remote request to update the sync timestamp. This request
# will need to be authenticated and therefore needs a user which has an
# actual userid - which the SpecialUsers.system doesn't.
user = app.acl_users.getUser('zopemaster')
user = user.__of__(app.acl_users)
newSecurityManager(app, user)

sync_ogds(plone, local_groups=is_workspace_feature_enabled())
transaction.commit()

0 comments on commit f2a7a34

Please sign in to comment.