~raj-abhilash1/mailman/gsoc

« back to all changes in this revision

Viewing changes to src/mailman/model/user.py

  • Committer: raj.abhilash1 at gmail
  • Date: 2014-03-23 07:17:47 UTC
  • Revision ID: raj.abhilash1@gmail.com-20140323071747-wz30a47eeocsdlmq
add new signature rule, docs and tests for it

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    _preferred_address = Reference(_preferred_address_id, 'Address.id')
63
63
    preferences_id = Int()
64
64
    preferences = Reference(preferences_id, 'Preferences.id')
 
65
    key_fp = Unicode()
65
66
 
66
67
    @dbconnection
67
68
    def __init__(self, store, display_name=None, preferences=None):
163
164
    @property
164
165
    def memberships(self):
165
166
        return Memberships(self)
 
167
 
 
168
    def import_key(self, keyid):
 
169
        """see `IUser`"""
 
170
        gpg = GPG()
 
171
        key = gpg.import_key(keyid)
 
172
        if key:
 
173
            # TODO: We need to verify first that the importd key 
 
174
            # actually belongs to the user. Incase it doesn't we 
 
175
            # delete the key, and send back an error. Do that thing
 
176
            # in the key_import_from_data also.
 
177
            self.key_fp = key.fingerprints[0]
 
178
            return key
 
179
        return None
 
180
 
 
181
    def import_key_from_data(self, key_data):
 
182
        """see `IUser`"""
 
183
        gpg = GPG()
 
184
        key = gpg.import_key_from_data(key_data)
 
185
        if key:
 
186
            self.key_fp = key.fingerprints[0]
 
187
            return key
 
188
        return None