Skip to content

Commit

Permalink
[mauro] rejectanonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTurtle committed Aug 13, 2024
1 parent efc76bd commit e1e0ce8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ Changelog
1.0a1 (unreleased)
------------------

- rejectanonymous (usato ad esempio per /admin nel buildout, vedi anche desing.plone.policy)
[mamico]

- Initial release.
[]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"collective.volto.enhancedlinks",
"collective.feedback",
"collective.volto.slimheader",
"iw.rejectanonymous",
],
extras_require={
"test": [
Expand Down
7 changes: 7 additions & 0 deletions src/iosanita/policy/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@

<!-- -*- extra stuff goes here -*- -->

<subscriber
for="Products.CMFCore.interfaces.ISiteRoot
zope.traversing.interfaces.IBeforeTraverseEvent"
handler=".rejectanonymous.insertRejectAnonymousHook"
/>


</configure>
8 changes: 8 additions & 0 deletions src/iosanita/policy/rejectanonymous.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from iw.rejectanonymous import rejectAnonymous


def insertRejectAnonymousHook(portal, event):
"""force authentication for request with X-ForceAuth header"""
if event.request.getHeader("X-ForceAuth"):
event.request.post_traverse(rejectAnonymous, (portal, event.request))

0 comments on commit e1e0ce8

Please sign in to comment.