Fixing and error causing duplicate roles to be created. (#339)
* Fixing and error causing duplicate roles to be created. * Fixing python3 * Fixing python2 and python3
This commit is contained in:
parent
be5dff8472
commit
b2539b843b
|
@ -57,7 +57,7 @@ class AuthorityInputSchema(LemurInputSchema):
|
||||||
@validates_schema
|
@validates_schema
|
||||||
def validate_subca(self, data):
|
def validate_subca(self, data):
|
||||||
if data['type'] == 'subca':
|
if data['type'] == 'subca':
|
||||||
if not data.get('authority'):
|
if not data.get('parent'):
|
||||||
raise ValidationError("If generating a subca parent 'authority' must be specified.")
|
raise ValidationError("If generating a subca parent 'authority' must be specified.")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Certificate(db.Model):
|
||||||
self.destinations = kwargs.get('destinations', [])
|
self.destinations = kwargs.get('destinations', [])
|
||||||
self.notifications = kwargs.get('notifications', [])
|
self.notifications = kwargs.get('notifications', [])
|
||||||
self.description = kwargs.get('description')
|
self.description = kwargs.get('description')
|
||||||
self.roles = kwargs.get('roles', [])
|
self.roles = list(set(kwargs.get('roles', [])))
|
||||||
self.replaces = kwargs.get('replacements', [])
|
self.replaces = kwargs.get('replacements', [])
|
||||||
self.signing_algorithm = defaults.signing_algorithm(cert)
|
self.signing_algorithm = defaults.signing_algorithm(cert)
|
||||||
self.bits = defaults.bitstrength(cert)
|
self.bits = defaults.bitstrength(cert)
|
||||||
|
|
|
@ -85,10 +85,10 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<select ng-model="authority.validityYears" class="form-control">
|
<select ng-model="authority.validityYears" class="form-control">
|
||||||
<option value="5">5 years</option>
|
<option value="">-</option>
|
||||||
<option value="10">10 years</option>
|
<option value="7">7 years</option>
|
||||||
|
<option value="14">14 years</option>
|
||||||
<option value="20">20 years</option>
|
<option value="20">20 years</option>
|
||||||
<option value="30">30 years</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<span style="padding-top: 15px" class="text-center col-sm-1">
|
<span style="padding-top: 15px" class="text-center col-sm-1">
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<select ng-model="certificate.validityYears" class="form-control">
|
<select ng-model="certificate.validityYears" class="form-control">
|
||||||
|
<option value="">-</option>
|
||||||
<option value="1">1 year</option>
|
<option value="1">1 year</option>
|
||||||
<option value="2">2 years</option>
|
<option value="2">2 years</option>
|
||||||
<option value="3">3 years</option>
|
<option value="3">3 years</option>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import six
|
import six
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from cryptography.fernet import Fernet, MultiFernet
|
from cryptography.fernet import Fernet, MultiFernet
|
||||||
|
@ -101,6 +102,9 @@ class Vault(types.TypeDecorator):
|
||||||
if not isinstance(value, six.string_types):
|
if not isinstance(value, six.string_types):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
value = bytes(value, 'utf8')
|
||||||
|
else:
|
||||||
value = bytes(value)
|
value = bytes(value)
|
||||||
|
|
||||||
return MultiFernet(self.keys).encrypt(value)
|
return MultiFernet(self.keys).encrypt(value)
|
||||||
|
|
Loading…
Reference in New Issue