AnsweredAssumed Answered

LazyDashborardFilter.java

Question asked by faisal on Mar 9, 2010
Latest reply on Mar 10, 2010 by dward
Hello

I am trying to modify the LazyDashboardFilter.java. So that it checks which group the user belongs to and creates different set dashboards for different set of user.

To see if that will work or not i did the following tests.

if (userid != null && userid.equals(URLDecoder.decode(matcher.group(1))))
            {
                if (serviceRegistry.getModelObjectService().getPage("user/" + userid + "/dashboard") == null)
                {
                    // no site found! create initial dashboard for this user…
                    Map<String, String> tokens = new HashMap<String, String>();
                    tokens.put("userid", userid);
                    serviceRegistry.getPresetsManager().constructPreset("user-dashboard", tokens);
                }
            }


To

if (userid != null && userid.equals(URLDecoder.decode(matcher.group(1))))
            {
                if (serviceRegistry.getModelObjectService().getPage("user/" + userid + "/dashboard") == null)
                {
                    // no site found! create initial dashboard for this user…
                    Map<String, String> tokens = new HashMap<String, String>();
                    tokens.put("userid", userid);
                    serviceRegistry.getPresetsManager().constructPreset("user-dashboard-2", tokens);
                }
            }

And then i added a preset with preset ID user-dashboard-2 in presets.xml. It did not work it still used the old user-dashboard preset.

I am a little confused about what is going on in here. I thought when a user is created in alfresco its dashboard is set to null. When the user first logs in to share the LazyDashboardFilter constructs the dashboard. The test result proves me wrong though.

Can any body tell me any other way of doing this.

Thanks in advance

Faisal

Outcomes