|
37 |
import threading |
37 |
import threading |
38 |
import gc |
38 |
import gc |
39 |
import functools |
39 |
import functools |
|
|
40 |
import pwd |
40 |
|
41 |
|
41 |
from univention.management.console import Translation |
42 |
from univention.management.console import Translation |
42 |
from univention.management.console.protocol.definitions import BAD_REQUEST_UNAUTH |
43 |
from univention.management.console.protocol.definitions import BAD_REQUEST_UNAUTH |
|
334 |
@LDAP_Connection |
335 |
@LDAP_Connection |
335 |
def create(self, ldap_object, container=None, superordinate=None, ldap_connection=None, ldap_position=None): |
336 |
def create(self, ldap_object, container=None, superordinate=None, ldap_connection=None, ldap_position=None): |
336 |
"""Creates a LDAP object""" |
337 |
"""Creates a LDAP object""" |
|
|
338 |
username = ldap_object['username'] |
339 |
posix_users = [user.pw_name for user in pwd.getpwall()] |
340 |
if username in posix_users: |
341 |
raise udm_errors.valueError(_('The username "%s" is already assigned to an existing POSIX user.') % username) |
342 |
|
337 |
if superordinate not in (None, 'None'): |
343 |
if superordinate not in (None, 'None'): |
338 |
try: |
344 |
try: |
339 |
ldap_position.setDn(superordinate) |
345 |
ldap_position.setDn(superordinate) |