svn keywords
[plcapi.git] / PLC / Methods / GetKeys.py
index 73ad9b6..9895710 100644 (file)
@@ -1,7 +1,10 @@
+# $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Filter import Filter
+from PLC.Persons import Person, Persons
 from PLC.Keys import Key, Keys
 from PLC.Auth import Auth
 
@@ -17,7 +20,7 @@ class GetKeys(Method):
     keys.
     """
 
-    roles = ['admin', 'pi', 'user', 'tech']
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
 
     accepts = [
         Auth(),
@@ -33,7 +36,8 @@ class GetKeys(Method):
        keys = Keys(self.api, key_filter, return_fields)
 
        # If we are not admin, make sure to only return our own keys       
-        if 'admin' not in self.caller['roles']:
+        if isinstance(self.caller, Person) and \
+           'admin' not in self.caller['roles']:
             keys = filter(lambda key: key['key_id'] in self.caller['key_ids'], keys)
 
         return keys