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

tetsubo
Champ in-the-making
Champ in-the-making
Nobody has an idea?..

anshu_kumar
Star Contributor
Star Contributor
As per my knowledge, you will have to define your custom presets. Like in your  case, one custom preset for each group. Because dashboard layout depends on the presets only.

In order to make it working, you can check the Groups of logged in user with the groups you desire the user to be. Based on that, you can pass the preset id to be picked.

zladuric
Champ on-the-rise
Champ on-the-rise
There are a few ways to do this, but it depends on which approach you take - at what moment are you aware of which dashboard you need? When user is created? Sometime after?

Depending on that, you can select the preset which you'd like to use when creating the new user.

Another option would be to programatically access alfresco store where Share keeps all the configurations (in the manner of XML files), where you can shuffle stuff around, add new components or change existing etc. This one is a bit of work though.

You'd also have to use the later approach when you want to change the dashboard for existing users.

tetsubo
Champ in-the-making
Champ in-the-making
Thank you for the replies. I wanted to try to change the default user dashboard on or immediately after creation on a new user. Currently, I think the best approach would be using the customise-dashboard web script.

ddraper
World-Class Innovator
World-Class Innovator
The presets.xml file is only used to generate and persist a users dashboard the first time that they log into Share. Once the dashboard is created it is accessed from a hidden location in the Repository - these files are then updated as the user customizes their dashboard. If you want to dynamically control the behaviour of a user dashboard based on group membership then I'd suggest that you set up some extension modules that are evaluated according to group membership and you can then dynamically alter the users dashboard. However, it is worth bearing in mind that the dashboards are configured using a grid-style named regions and that you may want to add custom regions into the template to avoid overriding user changes (…because it could be potentially confusing for a user to not see their dashboard customization reflected in on their dashboard).

tetsubo
Champ in-the-making
Champ in-the-making
Thanks for the reply, Dave! It is what I really want to do, as you describe: "set up some extension modules that are evaluated according to group membership". Now, I have a custom dashlet which is used to create new user. Immediately after that I want to use "customise-dashboard" with POST to change the default dashboard of that new user. The only problem is, that there is no such dashboard for that user in the AVM store and customise-dashboard throws error 500. So my question is: HOW to create an initial (even "dummy") dashboard for the user, so I can use customise-dashboard after that?

P.S. I know, that the initialisation is done through site-index.jsp when the user logs in for first time, but I need javascript code to talk to the PresetsManager in my case.

PLEASE, HELP!

tetsubo
Champ in-the-making
Champ in-the-making
Noone knows?..

zladuric
Champ on-the-rise
Champ on-the-rise
And why is it important that you set up this before the user has logged in for the first time? You'd get the same result if you just choose a preset for this user on creation and if you used a preset then created the dashboard based on this preset. In both cases the user would log in first time to his dashboard with the preset you chose.

Based on your comments:
- you have a dashlet for creating users
- when you're creating them, you also assign them to a group
- based on the group, you want that custom dashboard.

That can be done:
- look at the presets.xml file and search "user-dashboard" preset. Copy-paste that one (and rename each node) as many times as you have groups. In each group, add-remove components (future dashlets) for this preset.
- your user creation script does not create this user immediately, just keeps the data
- then you select the user group
- now you can select a preset for that user and create the user with a custom preset.

tetsubo
Champ in-the-making
Champ in-the-making
@Zlatko: that was my initial plan. The problem is in "- now you can select a preset for that user and create the user with a custom preset." How can I do this, when there is NO dashboard created for that user at that point?! I get error, when I try that. The presets.xml is called from site-index.jsp on first login of user, when there is no dashboard for that user. You see, the crushing point (and the answer to your question) is that when the user logs in for first time, that is the time where the dashboard is being initialised. AFTER THAT I can use customise-dashboard and use custom preset (e.g. from presets.xml). And that is too late, because the user has to see the customised dashboard when he logs in for first time (and later), based on group.

How to set the dashboard before the new user logs in (for first time)?

Or if not possible - how can I ask the group of the logging in user in site-index.jsp?