aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/restperm.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-07-16 15:50:53 +0100
committerPaul Eggleton <paul.eggleton@linux.intel.com>2014-09-24 11:32:34 +0100
commit1c9d6be527e334046ea4d8f6ae3617c6e9d166c2 (patch)
tree03124bdbf167e75cac3780741a5d41825188356b /layerindex/restperm.py
parent99b9b014db31b381e4486c57779ffa5de532c0bd (diff)
downloadopenembedded-core-contrib-1c9d6be527e334046ea4d8f6ae3617c6e9d166c2.tar.gz
expose REST API for layerindex
This patch enables a read-only REST API for the layerindex application using Django REST Framework. The objects of types Branch, LayerBranch and LayerItem are exposed to queries so that the layerindex application can function as a Layer Source in Toaster. The library dependencies are documented in the requirements.txt file. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'layerindex/restperm.py')
-rw-r--r--layerindex/restperm.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/layerindex/restperm.py b/layerindex/restperm.py
new file mode 100644
index 0000000000..fb9f715d26
--- /dev/null
+++ b/layerindex/restperm.py
@@ -0,0 +1,7 @@
+from rest_framework import permissions
+
+class ReadOnlyPermission(permissions.BasePermission):
+ def has_permission(self, request, view):
+ if request.method in permissions.SAFE_METHODS:
+ return True
+ return False