CORD-1863: Add leaf_model_name to User

Change-Id: Ib378d445ac2ec596a36281889ecba6a7df36147b
diff --git a/xos/core/models/core.xproto b/xos/core/models/core.xproto
index e5e7b64..0714036 100644
--- a/xos/core/models/core.xproto
+++ b/xos/core/models/core.xproto
@@ -69,6 +69,7 @@
      required string timezone = 30 [default = "America/New_York", max_length = 100, blank = False, null = False, db_index = False];
      required manytomany dashboards->DashboardView/UserDashboardView:user = 31 [db_index = False, null = False, blank = True];
      optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024];
+     required string leaf_model_name = 33 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"];
 }
 
 // A user may give a permission that he has to another user
diff --git a/xos/core/models/user.py b/xos/core/models/user.py
index 64199f7..e701d20 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -168,6 +168,7 @@
 
     dashboards = models.ManyToManyField(
         'DashboardView', through='UserDashboardView', blank=True)
+    leaf_model_name = models.CharField( help_text = "The most specialized model in this chain of inheritance, often defined by a service developer", max_length = 1024, null = False )
 
     policy_status = models.CharField( default = "0 - Policy in process", max_length = 1024, null = True )
 
@@ -281,6 +282,8 @@
                             model.save(update_fields=['enacted','deleted','policed'], silent=silent)
 
     def save(self, *args, **kwargs):
+        if not self.leaf_model_name:
+            self.leaf_model_name = "User"
 
         if not self.id:
             self.set_password(self.password)