If enabled, allow users and orgs to set their time machine expiration

Fixes https://www.pivotaltracker.com/story/show/142881203
This commit is contained in:
Joseph Schorr 2017-04-05 14:01:55 -04:00
parent eb5cebbcdf
commit 3dcbe3c631
25 changed files with 472 additions and 15 deletions

View file

@ -58,6 +58,7 @@ def org_view(o, teams):
if is_admin:
view['invoice_email'] = o.invoice_email
view['invoice_email_address'] = o.invoice_email_address
view['tag_expiration_s'] = o.removed_tag_expiration_s
return view
@ -139,10 +140,10 @@ class Organization(ApiResource):
'type': ['string', 'null'],
'description': 'The email address at which to receive invoices',
},
'tag_expiration': {
'tag_expiration_s': {
'type': 'integer',
'maximum': 2592000,
'minimum': 0,
'description': 'The number of seconds for tag expiration',
},
},
},
@ -196,9 +197,9 @@ class Organization(ApiResource):
logger.debug('Changing email address for organization: %s', org.username)
model.user.update_email(org, new_email)
if 'tag_expiration' in org_data:
logger.debug('Changing organization tag expiration to: %ss', org_data['tag_expiration'])
model.user.change_user_tag_expiration(org, org_data['tag_expiration'])
if features.CHANGE_TAG_EXPIRATION and 'tag_expiration_s' in org_data:
logger.debug('Changing organization tag expiration to: %ss', org_data['tag_expiration_s'])
model.user.change_user_tag_expiration(org, org_data['tag_expiration_s'])
teams = model.team.get_teams_within_org(org)
return org_view(org, teams)