Merge pull request #1589 from castrapel/issue_1570_ignorecasev2

Allow case insensitive role matching for cert permissions
This commit is contained in:
Curtis 2018-08-20 09:03:55 -07:00 committed by GitHub
commit a21b71a0e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -29,6 +29,9 @@ class CertificatePermission(Permission):
needs = [RoleNeed('admin'), RoleNeed(owner), RoleNeed('creator')] needs = [RoleNeed('admin'), RoleNeed(owner), RoleNeed('creator')]
for r in roles: for r in roles:
needs.append(CertificateOwnerNeed(str(r))) needs.append(CertificateOwnerNeed(str(r)))
# Backwards compatibility with mixed-case role names
if str(r) != str(r).lower():
needs.append(CertificateOwnerNeed(str(r).lower()))
super(CertificatePermission, self).__init__(*needs) super(CertificatePermission, self).__init__(*needs)