View | Details | Raw Unified | Return to bug 36210
Collapse All | Expand All

(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py (-3 / +1 lines)
 Lines 1566-1572   class object(univention.admin.handlers.simpleLdap, mungeddial.Support): Link Here 
1566
						raise univention.admin.uexceptions.primaryGroup
1566
						raise univention.admin.uexceptions.primaryGroup
1567
1567
1568
			if self['passwordexpiry']:
1568
			if self['passwordexpiry']:
1569
				today = time.strftime('%Y-%m-%d').split('-')
1569
				today = time.strftime('%Y-%m-%d', time.gmtime()).split('-')
1570
				expiry = self['passwordexpiry'].split('-')
1570
				expiry = self['passwordexpiry'].split('-')
1571
				# expiry.reverse()
1571
				# expiry.reverse()
1572
				# today.reverse()
1572
				# today.reverse()
1573
- 
1574
userexpiry
1573
userexpiry
1575
--
1576
.../modules/univention/admin/handlers/users/user.py | 21 +++++++++++++++++----
1574
.../modules/univention/admin/handlers/users/user.py | 21 +++++++++++++++++----
1577
1 file changed, 17 insertions(+), 4 deletions(-)
1575
1 file changed, 17 insertions(+), 4 deletions(-)
(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/users/user.py (-6 / +17 lines)
 Lines 36-41   import string Link Here 
36
import re
36
import re
37
import copy
37
import copy
38
import time
38
import time
39
import calendar
39
import types
40
import types
40
import struct
41
import struct
41
from M2Crypto import X509
42
from M2Crypto import X509
 Lines 1138-1145   def case_insensitive_in_list(dn, list): Link Here 
1138
	return False
1139
	return False
1139
1140
1140
1141
1142
def posixSecondsToDate(seconds):
1143
	return time.strftime("%Y-%m-%d", time.gmtime(seconds))
1144
1145
1141
def posixDaysToDate(days):
1146
def posixDaysToDate(days):
1142
	return time.strftime("%Y-%m-%d", time.gmtime(long(days) * 3600 * 24))
1147
	return posixSecondsToDate(long(days) * 3600 * 24)
1148
1149
1150
def dateToPosixSeconds(iso_date):
1151
	return calendar.timegm(time.strptime(iso_date, "%Y-%m-%d"))
1152
1153
1154
def dateToPosixDays(iso_date):
1155
	return dateToPosixSeconds(iso_date) / 3600 / 24
1143
1156
1144
1157
1145
def sambaWorkstationsMap(workstations):
1158
def sambaWorkstationsMap(workstations):
 Lines 1474-1480   class object(univention.admin.handlers.simpleLdap, mungeddial.Support): Link Here 
1474
		elif 'samba' in self.options:
1487
		elif 'samba' in self.options:
1475
			if self.oldattr.has_key('sambaKickoffTime'):
1488
			if self.oldattr.has_key('sambaKickoffTime'):
1476
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'sambaKickoffTime is: %s' % self.oldattr['sambaKickoffTime'][0])
1489
				univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'sambaKickoffTime is: %s' % self.oldattr['sambaKickoffTime'][0])
1477
				self.info['userexpiry'] = time.strftime("%Y-%m-%d", time.gmtime(long(self.oldattr['sambaKickoffTime'][0]) + (3600 * 24)))
1490
				self.info['userexpiry'] = posixSecondsToDate(self.oldattr['sambaKickoffTime'][0])
1478
1491
1479
		try:
1492
		try:
1480
			givenName = self.oldattr.get('givenName', [''])[0]
1493
			givenName = self.oldattr.get('givenName', [''])[0]
 Lines 2307-2313   class object(univention.admin.handlers.simpleLdap, mungeddial.Support): Link Here 
2307
			if 'samba' in self.options:
2320
			if 'samba' in self.options:
2308
				sambaKickoffTime = ''
2321
				sambaKickoffTime = ''
2309
				if self['userexpiry']:
2322
				if self['userexpiry']:
2310
					sambaKickoffTime = "%d" % long(time.mktime(time.strptime(self['userexpiry'], "%Y-%m-%d")))
2323
					sambaKickoffTime = str(dateToPosixSeconds(self['userexpiry']))
2311
					univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'sambaKickoffTime: %s' % sambaKickoffTime)
2324
					univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'sambaKickoffTime: %s' % sambaKickoffTime)
2312
				old_sambaKickoffTime = self.oldattr.get('sambaKickoffTime', '')
2325
				old_sambaKickoffTime = self.oldattr.get('sambaKickoffTime', '')
2313
				if old_sambaKickoffTime != sambaKickoffTime:
2326
				if old_sambaKickoffTime != sambaKickoffTime:
 Lines 2329-2335   class object(univention.admin.handlers.simpleLdap, mungeddial.Support): Link Here 
2329
				if self.__is_posix_disabled() and self.hasChanged('disabled') and not self.hasChanged('userexpiry'):
2342
				if self.__is_posix_disabled() and self.hasChanged('disabled') and not self.hasChanged('userexpiry'):
2330
					shadowExpire = '1'
2343
					shadowExpire = '1'
2331
				elif self['userexpiry']:
2344
				elif self['userexpiry']:
2332
					shadowExpire = "%d" % long(time.mktime(time.strptime(self['userexpiry'], "%Y-%m-%d")) / 3600 / 24 + 1)
2345
					shadowExpire = str(dateToPosixDays(self['userexpiry']))
2333
				elif self.__is_posix_disabled():
2346
				elif self.__is_posix_disabled():
2334
					shadowExpire = '1'
2347
					shadowExpire = '1'
2335
				else:
2348
				else:
2336
- 
2337
special posix cases
2349
special posix cases
2338
--
2339
.../tests/61_udm-users/25_script_lock_expired_accounts         | 10 +++++-----
2350
.../tests/61_udm-users/25_script_lock_expired_accounts         | 10 +++++-----
2340
.../tests/61_udm-users/25_script_lock_expired_passwords        |  6 +++---
2351
.../tests/61_udm-users/25_script_lock_expired_passwords        |  6 +++---
2341
2 files changed, 8 insertions(+), 8 deletions(-)
2352
2 files changed, 8 insertions(+), 8 deletions(-)
(-)a/test/ucs-test/tests/61_udm-users/25_script_lock_expired_accounts (-5 / +5 lines)
 Lines 3-9    Link Here 
3
## roles: [domaincontroller_master]
3
## roles: [domaincontroller_master]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages: [univention-directory-manager-tools]
5
## packages: [univention-directory-manager-tools]
6
## bugs: [35088]
6
## bugs: [35088, 36210]
7
7
8
from datetime import datetime, timedelta
8
from datetime import datetime, timedelta
9
import univention.admin.uldap
9
import univention.admin.uldap
 Lines 40-57   def main(): Link Here 
40
		for delta, initial_state, expected_state in [
40
		for delta, initial_state, expected_state in [
41
			[-9, 'none', 'none'],
41
			[-9, 'none', 'none'],
42
			[-8, 'none', 'none'],
42
			[-8, 'none', 'none'],
43
#			[-7, 'none', 'none'],  disabled due to bug #36210
43
			[-7, 'none', 'none'],
44
#			[-6, 'none', 'posix'],  disabled due to bug #36210
44
			[-6, 'none', 'posix'],
45
			[-5, 'none', 'posix'],
45
			[-5, 'none', 'posix'],
46
			[-4, 'none', 'posix'],
46
			[-4, 'none', 'posix'],
47
			[-3, 'none', 'posix'],
47
			[-3, 'none', 'posix'],
48
			[-2, 'none', 'posix'],
48
			[-2, 'none', 'posix'],
49
			[-1, 'none', 'posix'],
49
			[-1, 'none', 'posix'],
50
#			[0, 'none', 'posix'],  disabled due to bug #36210
50
			[0, 'none', 'posix'],
51
			[1, 'none', 'none'],
51
			[1, 'none', 'none'],
52
			[2, 'none', 'none'],
52
			[2, 'none', 'none'],
53
			[-4, 'windows', 'all'],
53
			[-4, 'windows', 'all'],
54
#			[0, 'windows', 'all'],  disabled due to bug #36210
54
			[0, 'windows', 'all'],
55
			[2, 'windows', 'windows'],
55
			[2, 'windows', 'windows'],
56
		]:
56
		]:
57
			userdata[create_user(delta, initial_state)] = [initial_state, expected_state]
57
			userdata[create_user(delta, initial_state)] = [initial_state, expected_state]
(-)a/test/ucs-test/tests/61_udm-users/25_script_lock_expired_passwords (-5 / +3 lines)
 Lines 3-9    Link Here 
3
## roles: [domaincontroller_master]
3
## roles: [domaincontroller_master]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages: [univention-directory-manager-tools]
5
## packages: [univention-directory-manager-tools]
6
## bugs: [35088]
6
## bugs: [35088, 36210]
7
7
8
import univention.admin.uldap
8
import univention.admin.uldap
9
import univention.admin.modules as udm_modules
9
import univention.admin.modules as udm_modules
 Lines 43-53   def main(): Link Here 
43
			[-3, 'none', 'posix'],
43
			[-3, 'none', 'posix'],
44
			[-2, 'none', 'posix'],
44
			[-2, 'none', 'posix'],
45
			[-1, 'none', 'posix'],
45
			[-1, 'none', 'posix'],
46
#			[0, 'none', 'posix'],  disabled due to bug #36210
46
			[0, 'none', 'posix'],
47
			[1, 'none', 'none'],
47
			[1, 'none', 'none'],
48
			[2, 'none', 'none'],
48
			[2, 'none', 'none'],
49
			[-4, 'windows', 'all'],
49
			[-4, 'windows', 'all'],
50
#			[0, 'windows', 'all'],  disabled due to bug #36210
50
			[0, 'windows', 'all'],
51
			[2, 'windows', 'windows'],
51
			[2, 'windows', 'windows'],
52
		]:
52
		]:
53
			userdata[create_user(delta, initial_state)] = [initial_state, expected_state]
53
			userdata[create_user(delta, initial_state)] = [initial_state, expected_state]
54
- 
55
subprocess.check_call()
54
subprocess.check_call()
56
--
57
test/ucs-test/tests/61_udm-users/25_script_lock_expired_accounts  | 4 ++--
55
test/ucs-test/tests/61_udm-users/25_script_lock_expired_accounts  | 4 ++--
58
test/ucs-test/tests/61_udm-users/25_script_lock_expired_passwords | 2 +-
56
test/ucs-test/tests/61_udm-users/25_script_lock_expired_passwords | 2 +-
59
2 files changed, 3 insertions(+), 3 deletions(-)
57
2 files changed, 3 insertions(+), 3 deletions(-)
(-)a/test/ucs-test/tests/61_udm-users/25_script_lock_expired_accounts (-2 / +2 lines)
 Lines 3-9    Link Here 
3
## roles: [domaincontroller_master]
3
## roles: [domaincontroller_master]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages: [univention-directory-manager-tools]
5
## packages: [univention-directory-manager-tools]
6
## bugs: [35088, 36210]
6
## bugs: [35088,36210]
7
7
8
from datetime import datetime, timedelta
8
from datetime import datetime, timedelta
9
import univention.admin.uldap
9
import univention.admin.uldap
 Lines 68-74   def main(): Link Here 
68
				utils.fail('uid=%s should not be locked for posix prior to script execution!' % (entry['username'],))
68
				utils.fail('uid=%s should not be locked for posix prior to script execution!' % (entry['username'],))
69
69
70
		print 'Calling lock_expired_accounts...'
70
		print 'Calling lock_expired_accounts...'
71
		subprocess.call(['/usr/share/univention-directory-manager-tools/lock_expired_accounts', '--only-last-week'])
71
		subprocess.check_call(['/usr/share/univention-directory-manager-tools/lock_expired_accounts', '--only-last-week'])
72
		print 'DONE'
72
		print 'DONE'
73
73
74
		results = udm_modules.lookup('users/user', None, lo, scope='sub', filter=ldap_filter)
74
		results = udm_modules.lookup('users/user', None, lo, scope='sub', filter=ldap_filter)
(-)a/test/ucs-test/tests/61_udm-users/25_script_lock_expired_passwords (-2 / +1 lines)
 Lines 64-70   def main(): Link Here 
64
				utils.fail('uid=%s should not be locked for posix prior to script execution!' % (entry['username'],))
64
				utils.fail('uid=%s should not be locked for posix prior to script execution!' % (entry['username'],))
65
65
66
		print 'Calling lock_expired_passwords...'
66
		print 'Calling lock_expired_passwords...'
67
		subprocess.call(['/usr/share/univention-directory-manager-tools/lock_expired_passwords'])
67
		subprocess.check_call(['/usr/share/univention-directory-manager-tools/lock_expired_passwords'])
68
		print 'DONE'
68
		print 'DONE'
69
69
70
		results = udm_modules.lookup('users/user', None, lo, scope='sub', filter=ldap_filter)
70
		results = udm_modules.lookup('users/user', None, lo, scope='sub', filter=ldap_filter)
71
- 

Return to bug 36210