Add user time zone support.
This commit is contained in:
parent
27712f599b
commit
f1af16fb84
7 changed files with 22 additions and 7 deletions
|
@ -324,7 +324,7 @@ class Groups(object):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
||||||
attributes = { 'cn' : groupName,
|
attributes = { 'cn' : groupName,
|
||||||
'fedoraRoleApprovaldate' : 'NotApproved',
|
'fedoraRoleApprovaldate' : 'None',
|
||||||
'fedoraRoleCreationDate' : str(now),
|
'fedoraRoleCreationDate' : str(now),
|
||||||
'fedoraRoleDomain' : 'None',
|
'fedoraRoleDomain' : 'None',
|
||||||
'fedoraRoleSponsor' : 'None',
|
'fedoraRoleSponsor' : 'None',
|
||||||
|
@ -397,7 +397,8 @@ class Person(object):
|
||||||
'fedoraPersonBugzillaMail' : mail.encode('utf-8'),
|
'fedoraPersonBugzillaMail' : mail.encode('utf-8'),
|
||||||
'postalAddress' : postalAddress.encode('utf-8'),
|
'postalAddress' : postalAddress.encode('utf-8'),
|
||||||
'fedoraPersonIrcNick' : '',
|
'fedoraPersonIrcNick' : '',
|
||||||
'userPassword' : 'Disabled'
|
'userPassword' : 'Disabled',
|
||||||
|
'fedoraPersonTimeZone' : 'UTC',
|
||||||
}
|
}
|
||||||
self.__server.add('cn=%s,%s' % (cn, self.__base), attributes)
|
self.__server.add('cn=%s,%s' % (cn, self.__base), attributes)
|
||||||
attributes = {
|
attributes = {
|
||||||
|
|
|
@ -122,7 +122,8 @@ class Group(controllers.Controller):
|
||||||
me = groups[userName]
|
me = groups[userName]
|
||||||
except:
|
except:
|
||||||
me = UserGroup()
|
me = UserGroup()
|
||||||
return dict(userName=userName, groups=groups, group=group, me=me)
|
u = Person.byUserName(userName)
|
||||||
|
return dict(userName=userName, u=u, groups=groups, group=group, me=me)
|
||||||
|
|
||||||
@identity.require(turbogears.identity.not_anonymous())
|
@identity.require(turbogears.identity.not_anonymous())
|
||||||
@expose(template="fas.templates.group.new")
|
@expose(template="fas.templates.group.new")
|
||||||
|
|
|
@ -64,10 +64,11 @@
|
||||||
<td py:if='groups[user].fedoraRoleSponsor == "None"'>None</td>
|
<td py:if='groups[user].fedoraRoleSponsor == "None"'>None</td>
|
||||||
<?python
|
<?python
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pytz import timezone
|
||||||
?>
|
?>
|
||||||
<td>${datetime.fromtimestamp(float(groups[user].fedoraRoleCreationDate))}</td>
|
<td>${datetime.fromtimestamp(float(groups[user].fedoraRoleCreationDate), timezone(u.fedoraPersonTimeZone))}</td>
|
||||||
<td py:if="groups[user].fedoraRoleApprovalDate.lower() == 'none'">${groups[user].fedoraRoleApprovalDate}</td>
|
<td py:if="groups[user].fedoraRoleApprovalDate.lower() == 'none'">${groups[user].fedoraRoleApprovalDate}</td>
|
||||||
<td py:if="groups[user].fedoraRoleApprovalDate.lower() != 'none'">${datetime.fromtimestamp(float(groups[user].fedoraRoleApprovalDate))}</td>
|
<td py:if="groups[user].fedoraRoleApprovalDate.lower() != 'none'">${datetime.fromtimestamp(float(groups[user].fedoraRoleApprovalDate), timezone(u.fedoraPersonTimeZone))}</td>
|
||||||
<td>${groups[user].fedoraRoleStatus}</td>
|
<td>${groups[user].fedoraRoleStatus}</td>
|
||||||
<td>${groups[user].fedoraRoleType}</td>
|
<td>${groups[user].fedoraRoleType}</td>
|
||||||
<!--<td>${groups[user].fedoraRoleDomain}</td>-->
|
<!--<td>${groups[user].fedoraRoleDomain}</td>-->
|
||||||
|
|
|
@ -37,6 +37,15 @@
|
||||||
<label for="postalAddress">Postal Address:</label>
|
<label for="postalAddress">Postal Address:</label>
|
||||||
<input type="text" id="postalAddress" name="postalAddress" value="${user.postalAddress}" />
|
<input type="text" id="postalAddress" name="postalAddress" value="${user.postalAddress}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="fedoraPersonTimeZone">Time Zone:</label>
|
||||||
|
<select id="fedoraPersonTimeZone" name="fedoraPersonTimeZone">
|
||||||
|
<?python
|
||||||
|
from pytz import common_timezones
|
||||||
|
?>
|
||||||
|
<option py:for="tz in common_timezones" value="${tz}" py:attrs="{'selected': user.fedoraPersonTimeZone == tz and 'selected' or None}">${tz}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="description ">Description:</label>
|
<label for="description ">Description:</label>
|
||||||
<textarea id="description" name="description">
|
<textarea id="description" name="description">
|
||||||
|
|
|
@ -172,7 +172,7 @@ class User(controllers.Controller):
|
||||||
@validate(validators=editUser())
|
@validate(validators=editUser())
|
||||||
@error_handler(error)
|
@error_handler(error)
|
||||||
@expose(template='fas.templates.user.edit')
|
@expose(template='fas.templates.user.edit')
|
||||||
def save(self, userName, givenName, mail, fedoraPersonBugzillaMail, telephoneNumber, postalAddress, fedoraPersonIrcNick='', fedoraPersonKeyId='', description=''):
|
def save(self, userName, givenName, mail, fedoraPersonBugzillaMail, telephoneNumber, postalAddress, fedoraPersonIrcNick='', fedoraPersonKeyId='', description='', fedoraPersonTimeZone='UTC'):
|
||||||
if not canEditUser(turbogears.identity.current.user_name, userName):
|
if not canEditUser(turbogears.identity.current.user_name, userName):
|
||||||
turbogears.flash(_("You do not have permission to edit '%s'" % userName))
|
turbogears.flash(_("You do not have permission to edit '%s'" % userName))
|
||||||
turbogears.redirect('/user/edit/%s', turbogears.identity.current.user_name)
|
turbogears.redirect('/user/edit/%s', turbogears.identity.current.user_name)
|
||||||
|
@ -187,6 +187,7 @@ class User(controllers.Controller):
|
||||||
user.telephoneNumber = telephoneNumber
|
user.telephoneNumber = telephoneNumber
|
||||||
user.postalAddress = postalAddress
|
user.postalAddress = postalAddress
|
||||||
user.description = description
|
user.description = description
|
||||||
|
user.fedoraPersonTimeZone = fedoraPersonTimeZone
|
||||||
except:
|
except:
|
||||||
turbogears.flash(_('Your account details could not be saved.'))
|
turbogears.flash(_('Your account details could not be saved.'))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -11,8 +11,9 @@ attributetypes: ( 2.5.444.17 NAME 'fedoraPersonCreationDate' DESC 'date entry wa
|
||||||
attributeTypes: ( 2.5.444.18 NAME 'fedoraPersonApprovalStatus' DESC 'users approval status' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{50} )
|
attributeTypes: ( 2.5.444.18 NAME 'fedoraPersonApprovalStatus' DESC 'users approval status' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{50} )
|
||||||
attributeTypes: ( 2.5.444.19 NAME 'fedoraPersonKeyId' DESC 'users GPG key ID' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{50} )
|
attributeTypes: ( 2.5.444.19 NAME 'fedoraPersonKeyId' DESC 'users GPG key ID' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{50} )
|
||||||
attributeTypes: ( 2.5.444.22 NAME 'fedoraPersonCertSerial' DESC 'users SSL cert serial' EQUALITY IntegerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
attributeTypes: ( 2.5.444.22 NAME 'fedoraPersonCertSerial' DESC 'users SSL cert serial' EQUALITY IntegerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
||||||
|
attributeTypes: ( 2.5.444.23 NAME 'fedoraPersonTimeZone' DESC 'time zone of the user' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{100} )
|
||||||
# fedoraPerson
|
# fedoraPerson
|
||||||
# The fedoraPerson represents people who are a member of the fedora project
|
# The fedoraPerson represents people who are a member of the fedora project
|
||||||
# in some way. It is a structural class and inherits
|
# in some way. It is a structural class and inherits
|
||||||
# from the inetOrgPerson class
|
# from the inetOrgPerson class
|
||||||
objectClasses: ( 2.5.555.1 NAME 'fedoraPerson' DESC 'A member of the fedoraproject group' SUP inetOrgPerson STRUCTURAL MUST ( fedoraPersonSshKey $ mail $ fedoraPersonCreationDate ) MAY (fedoraPersonIrcNick $ fedoraPersonApprovalStatus $ fedoraPersonBugzillaMail $ fedoraPersonKeyId $ fedoraPersonCertSerial ) )
|
objectClasses: ( 2.5.555.1 NAME 'fedoraPerson' DESC 'A member of the fedoraproject group' SUP inetOrgPerson STRUCTURAL MUST ( fedoraPersonSshKey $ mail $ fedoraPersonCreationDate $ fedoraPersonTimeZone ) MAY (fedoraPersonIrcNick $ fedoraPersonApprovalStatus $ fedoraPersonBugzillaMail $ fedoraPersonKeyId $ fedoraPersonCertSerial ) )
|
||||||
|
|
|
@ -255,6 +255,7 @@ def main():
|
||||||
userLdif.append(["fedoraPersonCreationDate",[str(timestamp)]])
|
userLdif.append(["fedoraPersonCreationDate",[str(timestamp)]])
|
||||||
userLdif.append(["fedoraPersonApprovalStatus",[str(user[13])]])
|
userLdif.append(["fedoraPersonApprovalStatus",[str(user[13])]])
|
||||||
userLdif.append(["description",[str(user[14])]]) #this one may be a streach -- original field was internal comments
|
userLdif.append(["description",[str(user[14])]]) #this one may be a streach -- original field was internal comments
|
||||||
|
userLdif.append(["fedoraPersonTimeZone",["UTC"]])
|
||||||
userLdif.append(["fedoraPersonIrcNick",[str(user[16])]])
|
userLdif.append(["fedoraPersonIrcNick",[str(user[16])]])
|
||||||
#userLdif.append(["ou",["Roles"]]) Adding an OU instead
|
#userLdif.append(["ou",["Roles"]]) Adding an OU instead
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue