e6c5f77df49ee7c283d9e6a524d6162d4f3c5a46
[plcapi.git] / PLC / Methods / AdmAddPersonKey.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Keys import Key, Keys
5 from PLC.Persons import Person, Persons
6 from PLC.Auth import PasswordAuth
7 from PLC.Methods.AddPersonKey import AddPersonKey
8
9 class AdmAddPersonKey(AddPersonKey):
10     """
11     Deprecated. See AddPersonKey. Keys can no longer be marked as
12     primary, i.e. the is_primary argument does nothing.
13     """
14
15     status = "deprecated"
16
17     accepts = [
18         PasswordAuth(),
19         Mixed(Person.fields['person_id'],
20               Person.fields['email']),
21         Key.fields['key_type'],
22         Key.fields['key'],
23         Parameter(int, "Make this key the primary key")
24         ]
25
26     def call(self, auth, person_id_or_email, key_type, key_value, is_primary):
27         return AddPersonKey.call(self, auth, person_id_or_email, key_type, key_value)