If the gadget/component is part of your code base, you can just add the dashboard default tab to the PlugInAreas property:
[Component]
public class YouTubeComponent : ComponentDefinitionBase
{
public YouTubeComponent()
: base("epi-cms.widget.HierarchicalList")
{
Categories = new string[] { "content" };
Title = "YouTube";
Description = "List content from YouTube";
SortOrder = 900;
PlugInAreas = new[] { PlugInArea.DashboardDefaultTab };
Settings.Add(new Setting("repositoryKey", YouTubeRepositoryDescriptor.RepositoryKey));
}
}
Thank you Linus!
Could I add the Gadget/Component only for users with a certain role? We only wish to add the gadget for users who need it due to their roles.
Hi!
Right now, the way this can be achieved is by defining a list of roles in the AllowedRoles property. This has the potentially negative side effect that users that are not part of these roles will not even be able to add this gadget manually. I will see if I can contribute a fix to make it possible to separate who should get the gadget automatically with access to it.
We actually need to create custom dashboard tabs for the user too, and add the gadgets programmatically for individual users.
Could you please help me with what Episerver API classes are used to manage dashboard tabs and gadgets?
Hi!
I've finally had the time to sit down and write some code to accomplish this. Not sure if you still need it but if you do, please have a look at the following repository:
Thank you, Linus! This will be useful for future use, and hopefully for others too.
Hi!
Is there a way to programmatically add a Gadget (and/or Tab) to a user's Dashboard? I'd like all users to have a custom Gadget pre-added when they log in.
Exactly the same post was asked and anwsered concerning CMS 6. But the same answer doesn't apply to CMS 7 :(