Programmatically Add Gadget for User

Vote:
 

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 :(

 

#82955
Mar 22, 2014 22:29
Vote:
 

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));
        }
    }

    

#82970
Edited, Mar 24, 2014 9:52
Vote:
 

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.

#82981
Mar 24, 2014 11:50
Vote:
 

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.

#83192
Mar 27, 2014 12:41
Vote:
 

That's good to know. Thanks again :)

#83650
Mar 30, 2014 17:25
Vote:
 

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?

#86470
May 22, 2014 11:45
Vote:
 

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:

https://github.com/LinusEkstrom/ViewConfigurationTests

#113037
Nov 11, 2014 12:27
Vote:
 

Thank you, Linus! This will be useful for future use, and hopefully for others too.

#113395
Nov 19, 2014 16:07
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.