Skip to content

Commit

Permalink
[IMP] users_ldap_populate: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRoca13 authored and carolinafernandez-tecnativa committed Sep 27, 2023
1 parent 87f39a6 commit ccb7204
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions users_ldap_populate/models/users_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class CompanyLDAP(models.Model):
default=lambda self: [(6, 0, [SUPERUSER_ID])],
)
deactivate_unknown_users = fields.Boolean(
string="Deactivate unknown users", default=False,
string="Deactivate unknown users",
default=False,
)

def action_populate(self):
Expand Down Expand Up @@ -142,7 +143,12 @@ def do_deactivate_unknown_users(self, known_user_ids):
for unknown_user in users:
_logger.debug("checking user %s", unknown_user.login)
present_in_ldap = any(
bool(self._get_ldap_entry_dicts(conf, user_name=unknown_user.login,))
bool(
self._get_ldap_entry_dicts(
conf,
user_name=unknown_user.login,
)
)
for conf in ldap_confs
)
if not present_in_ldap:
Expand Down
4 changes: 2 additions & 2 deletions users_ldap_populate/tests/test_users_ldap_populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def unbind(self):

@contextmanager
def patch_ldap(self, results):
""" defuse ldap functions to return fake entries instead of talking to a
server. Use this in your own ldap related tests """
"""defuse ldap functions to return fake entries instead of talking to a
server. Use this in your own ldap related tests"""
import ldap

original_initialize = ldap.initialize
Expand Down

0 comments on commit ccb7204

Please sign in to comment.