[sysadmin-bin] gnome_ldap_utils lives one level below
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] gnome_ldap_utils lives one level below
- Date: Thu, 12 Oct 2017 13:34:46 +0000 (UTC)
commit 2b4d369b9275bd67dd0887361e3aa92936393f12
Author: Andrea Veri <averi redhat com>
Date: Thu Oct 12 15:34:20 2017 +0200
gnome_ldap_utils lives one level below
gitlab/sync-ssh-keys.py | 3 +++
gnome_ldap_utils.py | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gitlab/sync-ssh-keys.py b/gitlab/sync-ssh-keys.py
index e10e7fb..d62c892 100755
--- a/gitlab/sync-ssh-keys.py
+++ b/gitlab/sync-ssh-keys.py
@@ -1,5 +1,8 @@
#!/usr/bin/python
+import sys
+sys.path.append('/home/admin/bin')
+
from gnome_ldap_utils import *
from gitlab import *
diff --git a/gnome_ldap_utils.py b/gnome_ldap_utils.py
index 2ba3086..c5baafc 100755
--- a/gnome_ldap_utils.py
+++ b/gnome_ldap_utils.py
@@ -22,7 +22,7 @@ class Gnome_ldap_utils:
def get_group_from_ldap(self, group):
import ldap.filter
-
+
filter = ldap.filter.filter_format('(&(objectClass=posixGroup)(cn=%s))', (group, ))
results = self.conn.search_s(self.LDAP_GROUP_BASE, ldap.SCOPE_SUBTREE, filter, ('member', ))
@@ -41,6 +41,8 @@ class Gnome_ldap_utils:
def get_attributes_from_ldap(self, uid, attr):
+ import ldap.filter
+
filter = ldap.filter.filter_format('(uid=%s)', (uid, ))
results = self.conn.search_s(self.LDAP_USER_BASE, ldap.SCOPE_SUBTREE, filter, ('uid', attr, ))
@@ -53,4 +55,4 @@ class Gnome_ldap_utils:
def get_uids_from_group(self, group):
people = self.get_group_from_ldap(group)
- return people
\ No newline at end of file
+ return people
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]