Skip to content

Commit e1d7b89

Browse files
committed
fix e commenti
1 parent a03ba3c commit e1d7b89

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name="redturtle.pasldap",
17-
version="1.0.0a0",
17+
version="1.0.0a1",
1818
description="A new addon for Plone",
1919
long_description=long_description,
2020
long_description_content_type="text/markdown",

src/redturtle/pasldap/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ def return_false(self, *args, **kwargs):
3333
LDAPUserPropertySheet.setProperties = return_false
3434

3535

36-
def debug(f):
37-
def _wrapper(*args, **kwargs):
38-
logger.debug("Entering %s", f.__name__)
39-
import pdb
40-
41-
pdb.set_trace()
42-
try:
43-
return f(*args, **kwargs)
44-
finally:
45-
logger.debug("Exiting %s", f.__name__)
46-
47-
return _wrapper
36+
# def debug(f):
37+
# def _wrapper(*args, **kwargs):
38+
# logger.debug("Entering %s", f.__name__)
39+
# import pdb
40+
#
41+
# pdb.set_trace()
42+
# try:
43+
# return f(*args, **kwargs)
44+
# finally:
45+
# logger.debug("Exiting %s", f.__name__)
46+
#
47+
# return _wrapper
4848

4949

5050
def apply_patches():

src/redturtle/pasldap/resilient.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@
99

1010
# logger = logging.getLogger(__name__)
1111

12+
# potential users in the Zope acl_users
13+
RESERVED_LOGINS = ["root", "admin", "adminrt"]
14+
RESERVED_IDS = ["root", "admin", "adminrt"]
15+
16+
# [node.ext.ldap:511][MainThread] LDAP search with filter: (&(objectClass=person)(sAMAccountName=root))
17+
18+
# [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': None, 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None, 'fullname': 'mario'} elapsed=32ms threshold=-1ms 🤔
19+
20+
# [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': None, 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None, 'email': 'mario'} elapsed=38ms threshold=-1ms 🤔
21+
22+
# [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': '...', 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None} elapsed=30ms threshold=-1ms 🤔
23+
24+
# XXX: se si fa una ricerca sul pannello di controllo, ad esempio con "mario" vengono comunque interrogati (almeno una volta)
25+
# tutti gli utenti dell'ldap ( !?)
26+
1227

1328
# OPIONINATED
1429
def resilient_enumerate_users(orig):
@@ -30,8 +45,12 @@ def _wrapper(
3045
cache_key = None
3146
if login is not None and exact_match:
3247
cache_key = "login:%s" % login
48+
if login in RESERVED_LOGINS:
49+
return []
3350
elif id is not None and exact_match:
3451
cache_key = "id:%s" % id
52+
if id in RESERVED_IDS:
53+
return []
3554
if (
3655
cache_key
3756
and hasattr(self, "_cache_users")

src/redturtle/pasldap/subscribers/startup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def site_load(event):
4949

5050
def check_pas(plugin):
5151
# import pdb; pdb.set_trace()
52+
# TODO: enumerateUsers deve essere dopo, rispetto a source_users e mutable_properties
53+
# in modo che le risoluzioni locali avvengano subito
5254
logger.info(" Check plugin: %s", plugin.getId())
5355
if plugin.is_plugin_active(pas_interfaces.IGroupEnumerationPlugin):
5456
logger.warning(
@@ -62,6 +64,7 @@ def check_pas(plugin):
6264
)
6365
if plugin.is_plugin_active(plonepas_interfaces.group.IGroupManagement):
6466
logger.warning(" [WARNING] GroupManagement is active => evaluate to disable")
67+
6568
# if plugin.is_plugin_active(pas_interfaces.IPropertiesPlugin):
6669
# logger.warning(" [WARNING] PropertiesPlugin is active => evaluate to disable")
6770
# if plugin.is_plugin_active(pas_interfaces.IRoleEnumerationPlugin):

0 commit comments

Comments
 (0)