Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

PowerShell script to set permissions on select pages within SP2007 pages library.

$
0
0

Environment: SP2007 x64, Windows 2003 OS, Posh 2.0

I have a site feature that re-creates all the pages in a library, upon feature activation. (actually I delete all the pages, and the feature creates them)  I have been pushing the developer to handle all this with the feature, but not making much progress.  And it is a real time waster for me...  Each time I re-deploy/upgrade the solution, and reactivate the feature, I have to reset the permissions on the pages.

When the pages are re-created, they inherit permissions from the libary.  And I have set permissions properly on the library.  But there are select "summary pages" that need specific permissions. And I am using SPgroups to assign permissions, all the groups already exist in the site/web.

$site = .\Get-SPSite.ps1 -url "http://site"
$RootWeb = $site.RootWeb
$dashpages = $RootWeb.Lists["Dashboard pages"]
$SUMpages = $dashpages.Items | ? {$_.title -like "*summary*"}
$SUMpages | ForEach-Object {$_.BreakRoleInheritance}

Now that I have broken inheritance, I want to remove the un-needed groups.  I want to remove every group except the associated owners group, and 2 other groups.

Thus far, I can list the Summary pages, and break inheritance on each.

I am kind of stuck at this point, I am not sure how to approach the part of looking at each $SUMpage, and removing the un-wanted groups.

Any assistance is appreciated.


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>