myldapsync 1.0.4__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of myldapsync might be problematic. Click here for more details.

Files changed (21) hide show
  1. {myldapsync-1.0.4/myldapsync.egg-info → myldapsync-1.0.6}/PKG-INFO +2 -1
  2. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/__init__.py +6 -0
  3. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/config.ini.example +7 -3
  4. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/myutils/users.py +4 -4
  5. {myldapsync-1.0.4 → myldapsync-1.0.6/myldapsync.egg-info}/PKG-INFO +2 -1
  6. {myldapsync-1.0.4 → myldapsync-1.0.6}/setup.py +2 -1
  7. {myldapsync-1.0.4 → myldapsync-1.0.6}/LICENSE +0 -0
  8. {myldapsync-1.0.4 → myldapsync-1.0.6}/MANIFEST.in +0 -0
  9. {myldapsync-1.0.4 → myldapsync-1.0.6}/README.md +0 -0
  10. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/config_default.ini +0 -0
  11. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/ldaputils/__init__.py +0 -0
  12. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/ldaputils/connection.py +0 -0
  13. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/ldaputils/users.py +0 -0
  14. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync/myutils/__init__.py +0 -0
  15. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync.egg-info/SOURCES.txt +0 -0
  16. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync.egg-info/dependency_links.txt +0 -0
  17. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync.egg-info/entry_points.txt +0 -0
  18. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync.egg-info/requires.txt +0 -0
  19. {myldapsync-1.0.4 → myldapsync-1.0.6}/myldapsync.egg-info/top_level.txt +0 -0
  20. {myldapsync-1.0.4 → myldapsync-1.0.6}/requirements.txt +0 -0
  21. {myldapsync-1.0.4 → myldapsync-1.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myldapsync
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Synchronise LDAP users to MySQL and MariaDB
5
5
  Home-page: https://github.com/6eh01der/myldapsync
6
6
  Author: Artur Lebedev
@@ -68,6 +68,7 @@ Classifier: Programming Language :: Python :: 3.8
68
68
  Classifier: Programming Language :: Python :: 3.9
69
69
  Classifier: Programming Language :: Python :: 3.10
70
70
  Classifier: Programming Language :: Python :: 3.11
71
+ Classifier: Programming Language :: Python :: 3.12
71
72
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
72
73
  Classifier: Operating System :: OS Independent
73
74
  Requires-Python: >=3.8
@@ -234,6 +234,12 @@ def main():
234
234
  cur.execute('%s' % privilege_list)
235
235
  cur.execute('%s' % user_grants)
236
236
  cur.execute('%s' % user_admin_grants)
237
+ if (filter_string := config.get('mysql', 'filter_string')) != '':
238
+ if "(objectClass=group)" in filter_string or "(objectClass=groupOfNames)" in filter_string:
239
+ cur.execute('GRANT PROXY ON "%s" TO ''@'';' % user_name)
240
+ if (admin_filter_string := config.get('mysql', 'admin_filter_string')) != '':
241
+ if "(objectClass=group)" in admin_filter_string or "(objectClass=groupOfNames)" in admin_filter_string:
242
+ cur.execute('GRANT PROXY ON "%s" TO ''@'';' % user_name)
237
243
  users_added = users_added + 1
238
244
  except mysql.connector.Error as exception:
239
245
  sys.stderr.write("Error creating user %s: %s" % (user,
@@ -41,16 +41,20 @@ search_scope = LEVEL
41
41
  base_dn = CN=Users,dc=example,dc=com
42
42
 
43
43
  # Filter string for the user search. For OpenLDAP, '(cn=*)' may well be enough.
44
- # For AD, you might use '(objectClass=user)' (REQUIRED)
44
+ # For AD, you might use '(objectClass=user)' for users or '(objectClass=group)' for groups (REQUIRED).
45
+ # For OpenLDAP '(objectClass=groupOfNames)' for groups.
45
46
  filter_string = (objectClass=user)
46
47
 
47
48
  # The base DN for the admin user search. This may be the same as the base_dn, or
48
49
  # may point to an alternate OU. If empty, no search will be performed.
49
50
  admin_base_dn = CN=Users,dc=example,dc=com
50
51
 
51
- # The filter string for users that should be created as superusers regardless of
52
- # the [general]/role_attribute_superuser setting. With AD you might use a filter
52
+ # The filter string for users that should have with "WITH ADMIN OPTION" and "WITH GRANT OPTION"
53
+ # for roles and privileges.
54
+ # With AD you might use a filter
53
55
  # such as: (&(objectClass=user)(memberof=CN=MYGROUP,CN=Users,dc=example,dc=com))
56
+ # '(objectClass=group)' or '(objectClass=groupOfNames)' should be used for groups synchronisation with AD or
57
+ # OpenLdap accordingly.
54
58
  # If, for example on OpenLDAP, your admin users are members of an alternate OU,
55
59
  # then a filter of (cn=*) may suffice.
56
60
  # If empty, no search will be performed.
@@ -68,13 +68,13 @@ def get_filtered_my_users(config, conn):
68
68
  return users
69
69
 
70
70
 
71
- def get_user_privileges(config, user, with_admin=False):
71
+ def get_user_privileges(config, user, with_grant=False):
72
72
  """Generate a list of user privileges to use when creating users
73
73
 
74
74
  Args:
75
75
  config (ConfigParser): The application configuration
76
76
  user (str): The user name to be granted privileges
77
- with_admin (bool): Generate a list of privileges that will have the WITH
77
+ with_grant (bool): Generate a list of privileges that will have the WITH
78
78
  GRANT OPTION specified, if True
79
79
  Returns:
80
80
  str: A SQL snippet listing the user privileges
@@ -88,7 +88,7 @@ def get_user_privileges(config, user, with_admin=False):
88
88
  else:
89
89
  database = '*'
90
90
 
91
- if config.getboolean('general', 'user_privilege_all') or with_admin:
91
+ if config.getboolean('general', 'user_privilege_all'):
92
92
  privilege_list = privilege_list + 'ALL' + ', '
93
93
  else:
94
94
  if config.getboolean('general', 'user_privilege_create'):
@@ -132,7 +132,7 @@ def get_user_privileges(config, user, with_admin=False):
132
132
 
133
133
  if privilege_list != '':
134
134
  sql = 'GRANT %s ON %s.* TO "%s"' % (privilege_list, database, user)
135
- if with_admin:
135
+ if with_grant:
136
136
  sql = sql + " WITH GRANT OPTION"
137
137
  sql = sql + ';'
138
138
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myldapsync
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Synchronise LDAP users to MySQL and MariaDB
5
5
  Home-page: https://github.com/6eh01der/myldapsync
6
6
  Author: Artur Lebedev
@@ -68,6 +68,7 @@ Classifier: Programming Language :: Python :: 3.8
68
68
  Classifier: Programming Language :: Python :: 3.9
69
69
  Classifier: Programming Language :: Python :: 3.10
70
70
  Classifier: Programming Language :: Python :: 3.11
71
+ Classifier: Programming Language :: Python :: 3.12
71
72
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
72
73
  Classifier: Operating System :: OS Independent
73
74
  Requires-Python: >=3.8
@@ -19,7 +19,7 @@ with open('README.md', 'r', encoding='utf-8') as fh:
19
19
 
20
20
  setuptools.setup(
21
21
  name="myldapsync",
22
- version="1.0.4",
22
+ version="1.0.6",
23
23
  author="Artur Lebedev",
24
24
  author_email="ras_atari@mail.ru",
25
25
  description="Synchronise LDAP users to MySQL and MariaDB",
@@ -36,6 +36,7 @@ setuptools.setup(
36
36
  'Programming Language :: Python :: 3.9',
37
37
  'Programming Language :: Python :: 3.10',
38
38
  'Programming Language :: Python :: 3.11',
39
+ 'Programming Language :: Python :: 3.12',
39
40
  "License :: OSI Approved :: GNU General Public License (GPL)",
40
41
  "Operating System :: OS Independent",
41
42
  ],
File without changes
File without changes
File without changes
File without changes
File without changes