CORD-1863: Add leaf_model_name to UseR

Change-Id: I3aeabb7b2d1575df30cf4e335dd43c6d7d91eeb4
diff --git a/xos/core/models/core.xproto b/xos/core/models/core.xproto
index f5ea149..919674c 100644
--- a/xos/core/models/core.xproto
+++ b/xos/core/models/core.xproto
@@ -68,6 +68,7 @@
      required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True];
      required string timezone = 30 [default = "America/New_York", max_length = 100, blank = False, null = False, db_index = False];
      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 d8dd616..596ac30 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -165,6 +165,8 @@
 
     timezone = TimeZoneField()
 
+    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 )
 
     objects = UserManager()
@@ -262,6 +264,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)