Added method to SimpleApiPlugins to allow locking API to only admins

This commit is contained in:
Gina Häußge committed 2015-04-21 19:39:48 +02:00
1 parent edd6acc012
commit 3f272b209d
2 files changed
+12 -1

No files matched your search

+6 -1
View File
@@ -469,7 +469,6 @@ class SimpleApiPlugin(OctoPrintPlugin):
__plugin_implementation__ = MySimpleApiPlugin()
Our plugin defines two commands, ``command1`` with no mandatory parameters and ``command2`` with one
mandatory parameter ``some_parameter``.
@@ -520,6 +519,12 @@ class SimpleApiPlugin(OctoPrintPlugin):
"""
return None
def is_api_adminonly(self):
"""
Return True if the API is only available to users having the admin role.
"""
return False
def on_api_command(self, command, data):
"""
Called by OctoPrint upon a POST request to ``/api/plugin/<plugin identifier>``. ``command`` will contain one of