Cloning SharePoint List Security (Freeware Security Tool)

I have run up into a cloning issue on other occasions, quite recently actually, since the project I am currently slated for has a really complex scheme in order to control user access to our local SharePoint instance and its related objects, as such sometimes rudimentary tasks like making two lists have identical user sets can prove to be a pain in the ass, so it would help to provide an automated way to do such tasks. Since this is always coming up, particularly during the initial provisioning process.

What lead to its creation was I was building a task management system that I am using some helper lists for, just storing some basic data that is pulled in by some sister WebParts. I was creating, deleting, recreating the lists and it became very, very tedious to keep setting the permissions. Although I could have changed the inheritance of the parent and just relied on feeding permissions, this unfortunately did not work for my particular situation due to some interesting trimming components that rely on certain security attributes from the parent. To complicate matters further, with the initial content provisioning that followed needed to ensure that sub-items (SPListItem’s and SPFolder’s) would if the names matched clone the item(s) security as well.

To make a long story short, it had to be done manually, there was really no native way to tackle the issue. And manually hurts.
From a project type standpoint, what I needed was a tiny WinForms application that would allow me to take a baseline stamp of existing permission sets as they are currently were bound to an SPList object, then take that and apply it to a new SPList object with just a couple clicks instead of having to wade through the plethora of SharePoint pages I otherwise would have to go through. This shouldn’t imply that it couldn’t be done in a WebPart or some other medium, however this was the quickest method. I will most likely look into a conversion of it later.
So, the process flow that I was looking to solve was a relatively simple one.

1) Locate / select a pre-existing list as it exists in SharePoint. This list should have the appropriate permissions on it representative of the set you would like to clone.

2) Find the secondary list that has a malformed / not yet set permission set.

3) Ensure that the permissions that are provided in the secondary do indeed represent the set that you would like to clone.

4) Begin the cloning taking into account checks like whether both objects inherit from the parent, which would definitively not represent an actionable function (other checks on inheritance are performed as well).
5) During the cloning, iterate through all SPListItem / SPFolder objects that are found. If the name matches, clone the permissions of the item as well.

So, without further hesitation, the SharePoint List Security Cloner, which is a very simple application taking to view URL’s that coordinate to the baseline list as well as the target list. All you have to do is put these two parameters into the application, and then following execute the application, the tracing of the operations will be written to the TextBox, following the adjustments to the list security should be accessible from the web interface.

Firstly, the main interface of the application:

As you can see in the above image, you are afforded to inputs into the application. The first is the source URL, or the SPList View URL of the list that you would like to use as a baseline. The second TextBox is the destination URL, which represents the target for the cloning as explained previously.Following, I am going to choose two URL’s of two different lists, cloning my Tasks list security attributes to my Calendar list. This is what the security of them looks like currently.Firstly, the baseline list permission settings:

Secondly, my Calendar list permission settings:

We can see that the variation between the two lists are development Members, Robert Lyon, and Viewers. I am going to now use the SharePoint List Security Cloner, and place the AllItems.aspx URL into the appropriate slots.

Once the execution starts, you will see a progress bar at the bottom of the main form that will disappear again when the execution is complete:

You can track the operations progress in the “Cloning Operations” section as well that will inform you of the specific progress that the application is making.

Afterwards, when I look at the permissions for the Calendar, I see that the security attributes were successfully cloned over!

Anyways, it was written for fun and my own utility more than anything, so I really can’t guarantee its going to work. Read the software disclaimer on the main site before downloading please! If you do run into errors or have feature suggestions to enhance it (posting such things in the comments generally motivates me to) please do post in the comments. I think my next version is still going to be a windows application but I am going to add the ability to toggle between sites, lists, etc.Download SharePoint List Security Cloner (the interface might have moved around a little bit from the above screenshots but the functionality is consistent).