https://fedorahosted.org/freeipa/ticket/5211
--
Petr Vobornik
From 3c62cdcc7e6e564dc34c1ef2a4262cdd3b36f91d Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 18 Aug 2015 12:50:54 +0200
Subject: [PATCH] vault: validate vault type

https://fedorahosted.org/freeipa/ticket/5211
---
 API.txt                 | 6 +++---
 VERSION                 | 4 ++--
 ipalib/plugins/vault.py | 5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/API.txt b/API.txt
index 9dbf86aedf2a1b62dabab21fb30bbceb2f0f237b..4d8d9dc3d3c38d4740bda3574396ecd85877b805 100644
--- a/API.txt
+++ b/API.txt
@@ -5423,7 +5423,7 @@ option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui
 option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Bytes('ipavaultpublickey', attribute=True, cli_name='public_key', multivalue=False, required=False)
 option: Bytes('ipavaultsalt', attribute=True, cli_name='salt', multivalue=False, required=False)
-option: Str('ipavaulttype', attribute=True, autofill=True, cli_name='type', default=u'standard', multivalue=False, required=False)
+option: StrEnum('ipavaulttype', attribute=True, autofill=True, cli_name='type', default=u'standard', multivalue=False, required=False, values=(u'standard', u'symmetric', u'asymmetric'))
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('service?')
@@ -5513,7 +5513,7 @@ arg: Str('criteria?', noextrawhitespace=False)
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
 option: Str('cn', attribute=True, autofill=False, cli_name='name', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.-]+$', primary_key=True, query=True, required=False)
 option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, query=True, required=False)
-option: Str('ipavaulttype', attribute=True, autofill=False, cli_name='type', default=u'standard', multivalue=False, query=True, required=False)
+option: StrEnum('ipavaulttype', attribute=True, autofill=False, cli_name='type', default=u'standard', multivalue=False, query=True, required=False, values=(u'standard', u'symmetric', u'asymmetric'))
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('pkey_only?', autofill=True, default=False)
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
@@ -5536,7 +5536,7 @@ option: Str('delattr*', cli_name='delattr', exclude='webui')
 option: Str('description', attribute=True, autofill=False, cli_name='desc', multivalue=False, required=False)
 option: Bytes('ipavaultpublickey', attribute=True, autofill=False, cli_name='public_key', multivalue=False, required=False)
 option: Bytes('ipavaultsalt', attribute=True, autofill=False, cli_name='salt', multivalue=False, required=False)
-option: Str('ipavaulttype', attribute=True, autofill=False, cli_name='type', default=u'standard', multivalue=False, required=False)
+option: StrEnum('ipavaulttype', attribute=True, autofill=False, cli_name='type', default=u'standard', multivalue=False, required=False, values=(u'standard', u'symmetric', u'asymmetric'))
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Flag('rights', autofill=True, default=False)
diff --git a/VERSION b/VERSION
index c42bea06522dae55e1a89ff94ae394594086b467..32f231a499a0e216a73c7334ed2361057d4b7ab7 100644
--- a/VERSION
+++ b/VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
 #                                                      #
 ########################################################
 IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=149
-# Last change: edewata - Added CLI param and ACL for vault service operations
+IPA_API_VERSION_MINOR=150
+# Last change: pvoborni - change type of vault type option to StrEnum
diff --git a/ipalib/plugins/vault.py b/ipalib/plugins/vault.py
index 88c63071f04462aa240a70d3a3eeac2d04e66062..70304c33b181a4c8d2278bfa1a7003c241fce064 100644
--- a/ipalib/plugins/vault.py
+++ b/ipalib/plugins/vault.py
@@ -38,7 +38,7 @@ import krbV
 
 from ipalib.frontend import Command, Object, Local
 from ipalib import api, errors
-from ipalib import Bytes, Str, Flag
+from ipalib import Bytes, Flag, Str, StrEnum
 from ipalib import output
 from ipalib.crud import PKQuery, Retrieve, Update
 from ipalib.plugable import Registry
@@ -277,11 +277,12 @@ class vault(LDAPObject):
             label=_('Description'),
             doc=_('Vault description'),
         ),
-        Str(
+        StrEnum(
             'ipavaulttype?',
             cli_name='type',
             label=_('Type'),
             doc=_('Vault type'),
+            values=(u'standard', u'symmetric', u'asymmetric', ),
             default=u'standard',
             autofill=True,
         ),
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to