from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.KeyTypes import KeyType, KeyTypes
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
class AddKeyType(Method):
"""
roles = ['admin']
accepts = [
- PasswordAuth(),
+ Auth(),
KeyType.fields['key_type']
]
returns = Parameter(int, '1 if successful')
- event_type = 'Add'
- object_type = 'KeyType'
def call(self, auth, name):
key_type = KeyType(self.api)
key_type['key_type'] = name
- key_type.sync()
+ key_type.sync(insert = True)
return 1