cancel
Showing results for 
Search instead for 
Did you mean: 

Custom default dashboard (preset) depending on group

tetsubo
Champ in-the-making
Champ in-the-making
Hello Alfresco Team and All,


currently I have the following problem:

Afaik preset.xml is used to generate the default dashboard for new users. I know how I can extend description file with my own presets and change the dashboard for all existing users or all new users. I would like now to change the default dashboard for each new user depending on the group he/she is member of.

How should I do that? Any suggestions and help, please?

Thanks in advance!
12 REPLIES 12

zladuric
Champ on-the-rise
Champ on-the-rise
I've just remembered how I have solved this. But that comes later, first, another approach. I'm now looking at site-index.jsp, there's this:

// no user dashboard page found! create initial dashboard for this user…
      Map<String, String> tokens = new HashMap<String, String>();
      tokens.put("userid", userid);
      FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens);


So, one way to create this dashboard would be to:
- extend the SlingshotUserFactory to add this group on the session object. Now you can get it just like the userid:
String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID);

So now you can use some logic in tthe
constructPreset()
method call to adjust to this.

But the other way I have been doing this, it was a long time ago (share 3.0 or something), was dealt within Share controllers. I had to create custom (additional) site dashboards dynamically. It was done with siteData.newPage(), siteData.createComponents() and similar. I don't have the code, it was an old project, and the code is not mine, but I remember that there was a method that created new alfresco pages, page components. And I think this is what Alfresco does anyway - just automatizes the process.

Check the siteData object here:
http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Freferences%2FAPISurf-r...


tetsubo
Champ in-the-making
Champ in-the-making
Thanks, Zlatko, I will try that out! Extending SlingshotUserFactory is something I have never done, don't know how to do that right, so I am gonna try the "trick" with sitedata and init the dashboard for the new user right after he is created. I need further details how and where to store the dashboard, any idea? At least I got new spot to work on!

tetsubo
Champ in-the-making
Champ in-the-making
Ok, this didn't really helped. Now I would like to create the USER dashboard from a dashlet (that I use to create the user). Afaik there are two parts of that procedure - backend and web tier. In share I would do this with with sitedata.newPreset(…). But what about the back-end? How to do that? Plase, help!