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

Atlassian Cloud: Understanding Zero Trust Security

Atlassian Cloud: Understanding Zero Trust Security

Where To Start & Why It Matters What is the Atlassian Cloud Zero Trust Security model? Well, for decades, enterprise security controls were built to protect a large, single perimeter around a corporation. Often described as castle-and-moat security, This approach...

Related Resources

Top 6 Ways To Improve Your DevOps Journey

Top 6 Ways To Improve Your DevOps Journey

Knowing how to improve DevOps can be challenging. But, creating an integrated DevOps toolchain can set organizations apart from the rest. This is because having a well-defined business DevOps journey can reduce errors, improve collaboration and drastically increase...

Solidworks PDM How To: Using Copy Tree

Solidworks PDM How To: Using Copy Tree

https://youtu.be/W-fFjhEiiuE Hi everyone! I'm Daniela, the SolidWorks PDM SME for SPK and Associates. Today, we'll discover the tool for SolidWorks how to use Copy Tree functionality. This is a SolidWorks PDM tool that isn't frequently used but is particularly...

2022: The Year So Far Tech Review

2022: The Year So Far Tech Review

There’s been a lot of innovation, software and product releases in the past six months alone. So, we are rounding up the best tech review and engineering releases for the first half of 2022. The tech forecast for 2022 was heavily influenced by how the world adjusted...