Merge from trunk
[plcapi.git] / trunk / PLC / Methods / AuthCheck.py
diff --git a/trunk/PLC/Methods/AuthCheck.py b/trunk/PLC/Methods/AuthCheck.py
new file mode 100644 (file)
index 0000000..0a4c260
--- /dev/null
@@ -0,0 +1,16 @@
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.Auth import Auth, BootAuth
+
+class AuthCheck(Method):
+    """
+    Returns 1 if the user or node authenticated successfully, faults
+    otherwise.
+    """
+
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
+    accepts = [Auth()]
+    returns = Parameter(int, '1 if successful')
+
+    def call(self, auth):
+        return 1