added rbac for viewing objects
[plstackapi.git] / planetstack / core / models / tag.py
index cbe63a5..ef746da 100644 (file)
@@ -22,3 +22,16 @@ class Tag(PlCoreBase):
     def __unicode__(self):
         return self.name
 
+
+    def can_update(self, user):
+        if user.is_admin:
+            return True
+        return False
+
+    def save_by_user(self, user, *args, **kwds):
+        if self.can_update(user):
+            super(Tag, self).save(*args, **kwds)
+
+    @staticmethod
+    def select_by_user(user):
+        return Tag.objects.all()