Merge pull request #271 from kevgliss/195

Closes #195
This commit is contained in:
kevgliss 2016-04-08 12:01:10 -07:00
commit 3f89d6d009
3 changed files with 29 additions and 14 deletions

View File

@ -357,6 +357,7 @@ class CertificatesList(AuthenticatedResource):
self.reqparse.add_argument('replacements', type=list, default=[], location='json') self.reqparse.add_argument('replacements', type=list, default=[], location='json')
self.reqparse.add_argument('validityStart', type=str, location='json') # TODO validate self.reqparse.add_argument('validityStart', type=str, location='json') # TODO validate
self.reqparse.add_argument('validityEnd', type=str, location='json') # TODO validate self.reqparse.add_argument('validityEnd', type=str, location='json') # TODO validate
self.reqparse.add_argument('validityYears', type=int, location='json') # TODO validate
self.reqparse.add_argument('authority', type=valid_authority, location='json', required=True) self.reqparse.add_argument('authority', type=valid_authority, location='json', required=True)
self.reqparse.add_argument('description', type=str, location='json') self.reqparse.add_argument('description', type=str, location='json')
self.reqparse.add_argument('country', type=str, location='json', required=True) self.reqparse.add_argument('country', type=str, location='json', required=True)

View File

@ -82,6 +82,12 @@ def process_options(options):
data['specificEndDate'] = str(end_date) data['specificEndDate'] = str(end_date)
data['validityPeriod'] = period data['validityPeriod'] = period
elif options.get('validityYears'):
if options['validityYears'] in [1, 2]:
data['validityPeriod'] = str(options['validityYears']) + 'Y'
else:
raise Exception("Verisign issued certificates cannot exceed two years in validity")
return data return data

View File

@ -79,24 +79,32 @@
tooltip="If no date is selected Lemur attempts to issue a 2 year certificate"> tooltip="If no date is selected Lemur attempts to issue a 2 year certificate">
Validity Range <span class="glyphicon glyphicon-question-sign"></span> Validity Range <span class="glyphicon glyphicon-question-sign"></span>
</label> </label>
<div class="col-sm-2">
<div class="col-sm-4"> <select ng-model="certificate.validityYears" class="form-control">
<div> <option value="1">1 year</option>
<div class="input-group"> <option value="2">2 years</option>
<input tooltip="Starting Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd" <option value="3">3 years</option>
is-open="$parent.openNotBefore.isOpen" min-date="certificate.authority.notBefore" <option value="4">4 years</option>
max-date="certificate.authority.maxDate" ng-model="certificate.validityStart"/> </select>
<span class="input-group-btn"> </div>
<button class="btn btn-default" ng-click="openNotBefore($event)"><i <span style="padding-top: 15px" class="text-center col-sm-1">
class="glyphicon glyphicon-calendar"></i></button> <strong>- or -</strong>
</span> </span>
</div> <div class="col-sm-3">
<div class="input-group">
<input tooltip="Starting Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd"
is-open="$parent.openNotBefore.isOpen" min-date="certificate.authority.notBefore"
max-date="certificate.authority.maxDate" ng-model="certificate.validityStart"/>
<span class="input-group-btn">
<button class="btn btn-default" ng-click="openNotBefore($event)"><i
class="glyphicon glyphicon-calendar"></i></button>
</span>
</div> </div>
</div> </div>
<span style="padding-top: 15px" class="text-center col-sm-2"><label><span <span style="padding-top: 15px" class="text-center col-sm-1"><label><span
class="glyphicon glyphicon-resize-horizontal"></span></label></span> class="glyphicon glyphicon-resize-horizontal"></span></label></span>
<div class="col-sm-4"> <div class="col-sm-3">
<div> <div>
<div class="input-group"> <div class="input-group">
<input tooltip="Ending Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd" <input tooltip="Ending Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd"