fbpx
1-888-310-4540 (main) / 1-888-707-6150 (support) info@spkaa.com
Select Page

Electric Commander (Now CloudBees CD) Transferring Homepage Settings Between Users

Published by Carlos Almeida
on April 21, 2015

The Electric Commander homepage allows you to bookmark links and job configurations for easy access. It’s easy to add one or two, but if you have a lot of links and you want to share them with other users so that they have the same links as well, its a lot of work to do manually one at a time.

In this video, I demonstrate the technique for copying these settings between users and provide a script that users can download and install as a Commander plugin.

Video Transcript:

Let’s say that you have your (Electric) Commander home page set up exactly the way you want it. You’ve got links all your important places both in and outside of commander and you’ve got your job configuration set up to launch your jobs at the push of a button. Adding one or two links your setup isn’t a big deal but suppose you want to replicate all of your settings in another user’s account or worse suppose you decide you want to share your settings with an entire team. Manually recreating a set of links of any substantial size would take forever. So what do you do? First you need to know that these home page settings are stored as properties under your user name. If you pull up your user object to the web UI and run browse to the user settings property sheet you’ll see the two property sheets were interested in: Job configurations and Shortcuts. Under each property sheet is a set of further property sheets describing the links. What will be nice is to be able to use easy tools clone method to copy one users job configurations or shortcuts property sheet over to another users but unfortunately it won’t work. Clone won’t overwrite properties that already exist and even if the target user doesn’t have any job configs or shortcuts to find those property sheets are present already. The other problem is that we really don’t want to erase any settings the target user may already have defined. We want to add to their home page and not replace it. This means we have to clone each the individual entries under these property sheets for every user we want to update. So what we do is create a short script to clone each job config or shortcut individually for a given set of users. I created a working example as a commander procedure. Let’s take a look. First, note that i have three parameters: from user, to users and user settings to copy. “From user” is a simple text field where you enter a single user name from which all the settings will be copied. “To users” is a text area field that allows you to enter a new line separated list of usernames to which you would like to copy the settings. And “user setting to copy” is a radius selection that allows you to choose the setting to copy.

Now let’s look at the procedure itself. Taking a look at the procedure, we see that we have our standard easy pearl heading for a job step command. We instantiate a commander object and we store the parameters we’ve passed in. Then we execute a get properties request for the particular setting we’re interested in and use the “get setting names” sub procedure to collect the names of the properties that define each of the custom settings. Finally, for each target user we iterate over the list of settings and clone each one from the source user to the target user. The call to clone itself is enclosed in an eval block because even if the clone operation fails for some reason we want to keep going and not end up in some odd state in which half the target users don’t have the settings applied because the step failed on one operation. Instead we record which transaction failed in the log and use post p to display the number of failed transactions in the job step summary. Then you can go back later and resolve any issues individually. If we run the procedure entering admin as the “from user”, the set of 20 users recreated as the “to users” and choose shortcuts as “the setting the copy”, we see that the procedure executes. And if we login as one of these new users, they will have the same set of shortcuts as admin. If you’d like to use the procedure or modify it for some other purpose I’ve converted this project into a plug-in and have the jar available for download. Simply import and promote the plug-in jar file and a project name “SPK Utilities” will be created that contains this procedure.

Latest White Papers

6 Secrets To A Successful Atlassian Migration At Scale

6 Secrets To A Successful Atlassian Migration At Scale

With large scale migrations, large user bases, multiple Atlassian tools, plenty of apps, and lots of data, moving to Atlassian Cloud may feel like a steep mountain to climb. But, it doesn't have to be. In fact, we've already helped many customers make the move. Plus,...

Related Resources

Setting Up SolidWorks PDM Permissions

Setting Up SolidWorks PDM Permissions

Hi everyone, my name is Daniela. I’m the SME for both SolidWorks and SolidWorks PDM at SPK and Associates. Today I'll be showing you the basic of setting up SolidWorks PDM permissions. Initially, these can be pretty cumbersome to set up. But I'll show you some of the...

Jira Cloud vs Azure DevOps Cost: Are You Paying Too Much?

Jira Cloud vs Azure DevOps Cost: Are You Paying Too Much?

Choosing the right issue and feature tracking tools to manage your software development lifecycle is important. It can be the difference between speed to market, budget savings and even boosting DevOps team morale. Whilst there are plenty of tools in the market, in...

DevOps World 2022 Recap And More From CloudBees

DevOps World 2022 Recap And More From CloudBees

DevOps World 2022 was originally set to take place in Orlando, FL on Wednesday 28th September and Thursday 29th September.  Unfortunately, Hurricane Ian had other plans and the DevOps World in-person component was canceled. Instead, a virtual conference was launched....