cancel
Showing results for 
Search instead for 
Did you mean: 

reseting users dashboards to defaults

stk137
Champ in-the-making
Champ in-the-making
How can I reset users dashboards so that anyone who has configured theirs loses the configuration and sees the default.

I am not trying to prevent them from configuring it in the future, I just want to reset them once as a part of new version install to see our newly develop dashlets in the default dashboard.
5 REPLIES 5

kevinr
Star Contributor
Star Contributor
Assuming you are using 2.1, then that can be done using the  JavaScript API, it requires some knowledge of how we store user preferences (via an aspect on the Person and then following an association of a specific type) which is a little fiddly so i've written the script that will work here:

var people = search.luceneSearch("TYPE:cm\\:person");
for each (p in people)
{
   logger.log("Found user: " + p.properties.userName);
   if (p.hasAspect("app:configurable"))
   {
      var config = p.childAssocs["app:configurations"][0];
      var prefs = config.childrenByXPath("app:preferences");
      if (prefs.length == 1)
      {
         var preferences = prefs[0];
         if (preferences.properties["app:dashboard"] != null)
         {
            preferences.properties["app:dashboard"] = null;
            preferences.save();
            logger.log(" preferences found and cleared.");
         }
      }
   }
}
If you run this as admin (via URL or whatever) then it will clear all user dashboard preferences.

Thanks,

Kevin

stk137
Champ in-the-making
Champ in-the-making
Assuming you are using 2.1

Kevin

Many thanks!

I am using 2.1 and I'll give this a try.

I had poked around the node browser and saw the dashboard configs, but didn't understand things well enough yet to come up with a query and script that worked.

stk137
Champ in-the-making
Champ in-the-making


var people = search.luceneSearch("TYPE:cm\\:person");

If you run this as admin (via URL or whatever) then it will clear all user dashboard preferences.

It's not reseting all.
Are JavaScript lucene searches limited by search-max-results (in web-client-config)?

kevinr
Star Contributor
Star Contributor
That's odd - i tested it here on a 2.1 installation, executed as the admin user and it worked.

No it is not limited by web-client-config settings.

Kevin

stk137
Champ in-the-making
Champ in-the-making
That's odd - i tested it here on a 2.1 installation, executed as the admin user and it worked.

No it is not limited by web-client-config settings.

Kevin

I ran it as an administrator (but not "admin") and looked at the logs and some accounts were never touched including my own which is an administrator (but not "admin" itself).  Unfortunately I did more than one thing to try to make it work and I can't remember the sequence now.  I deleted some accounts, increased the search limit, ran it as "admin", and at some point my account showed up in the logs and was reset.  Now that I think about it some of the other missing accounts which showed up later were also admins.