Site Owners can delete their own sites. A cool power user feature, but… do you trust them with this power?
Before we go on, even if you remove the ability to delete a site, you should still install the site undelete tool from CodePlex. Just in case, you know…
Here’s two ways I’ve thought of to deal with Delete Site…
- Replace the Delete Site page
- Hide the Delete Site link using a feature
(both require access to the web servers)
Idea #1 – Get rid of the site delete page!
Well, not get rid of it, but hide it. The site delete page is in the 12 hive: …\12\template\layout\deleteweb.apx. The quickest way to make this page unavailable is to just rename it, say to deletewebforadminonly.aspx. You can then still use the page to delete a site by going directly to http://servername/sitename/_layouts/deletewebforadminonly.aspx.
What will the site owners see if they click the Delete Site link? The standard SharePoint “Unknown Error” error page. Want something better? After renaming the deleteweb page create a new deleteweb page with something like “To delete this site please contact your SharePoint Administrator at 123-1234”.
Sample deletesite.aspx page:
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"%>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
Delete Web Site
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
Delete Web Site
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
The "Delete Site" command has been disabled. <br><br>
To delete this site please contact your SharePoint Administrator
</asp:Content>
Idea #2 – Use a Feature:
A SharePoint feature can be enabled and disabled at any time without modifying a site or page. Using this feature described here will hide the Delete Site command from your Site Owners, but they can still go directly to the deletesite.aspx page if they can guess the URL.
Create these files in the Features folder with a name like: …\12\Features\HideDeleteSite
In the feature.xml file pick the Scope you would like to use: Farm, WebApplication, Site or Web.
Feature.xml
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="00BFEA71-A83E-497E-9BA0-7A5C597D0106"
Title="Hide the Delete Site option"
Description="Remove the ability for the site owner to delete sites."
Version="1.0.0.0"
Scope="Web"
Hidden="FALSE"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="HideDeleteSite.xml" />
</ElementManifests>
</Feature>
HideDeleteSite.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<HideCustomAction
Id="HideDeleteSite"
HideActionId="DeleteWeb"
GroupId="SiteAdministration"
Location="Microsoft.SharePoint.SiteSettings" />
</Elements>
Then run the STSADM’s install feature command.
STSADM -o installfeature -name HideDeleteSite
Go to Central Admin or the site or site collection, depending on the scope you selected, and enable the feature.
Watch outs, got-yas, etc.
- If you delete or rename deletesite.aspx you may find it restored after a service pack update.
- If you use a Feature, remember that if you set the Scope to Web or Site the Site Owner or the Site Administrator will be able to disable it.
- Remember to add this little fix to your disaster plan. Just one more thing to do when you have to rebuild your servers, or add a new web server to the farm.
.
No comments:
Post a Comment