Merge from trunk
[plcapi.git] / trunk / PLC / Methods / GetRoles.py
diff --git a/trunk/PLC/Methods/GetRoles.py b/trunk/PLC/Methods/GetRoles.py
new file mode 100644 (file)
index 0000000..0456662
--- /dev/null
@@ -0,0 +1,21 @@
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.Roles import Role, Roles
+from PLC.Auth import Auth
+
+class GetRoles(Method):
+    """
+    Get an array of structs containing details about all roles.
+    """
+
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
+
+    accepts = [
+        Auth()
+        ]
+
+    returns = [Role.fields]
+    
+    def call(self, auth):
+       return Roles(self.api)