fix users list not subtracted properly when displaying picker
diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js
index 929552c..96465d3 100644
--- a/planetstack/core/xoslib/static/js/xosTenant.js
+++ b/planetstack/core/xoslib/static/js/xosTenant.js
@@ -264,6 +264,8 @@
         tenantSites = new XOSTenantSiteCollection();

         tenantSites.getFromSlice(model);

         model.usersBuffer = model.attributes.users; /* save a copy of 'users' that we can edit. This prevents another view (developer) from overwriting our copy with a fetch from the server */

+        model.usersOrig = model.attributes.users;   /* save an immutable copy that we'll use for username lookups */

+        model.user_namesOrig = model.attributes.user_names;

         model.tenantSiteCollection = tenantSites;

         XOSTenantApp.tenantSites = tenantSites;

 

diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-util.js b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
index 7a57d8a..59fb06e 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xos-util.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
@@ -93,6 +93,18 @@
   return diff;

 }
 
+function array_subtract(a1, a2)
+{
+    result=[]
+    for (index in a1) {
+        value = a1[index];
+        if (!$.inArray(value, a2) >= 0) {
+            result.push(value);
+        }
+    }
+    return result;
+}
+
 function array_pair_lookup(x, names, values)
 {
     for (index in values) {