I am building a site where users have Contribute access. They are allowed to add, modify, remove items in any of the lists, but they are not allowed to change or remove the lists. However, they also need to be allowed to create new survey lists.
I'm leaning toward creating a custom page or web part that users in the Members group can access. Based on their entries, I can create the list with SPSite.SystemAccount and then grant the Members group Full Control on the list.
Any better ideas?
ManageLists is too broad. Can I create a permission level that only grants the ability to create lists? Or can I limit list management to a certain template?
Solution:
In the end, I created a customized version of new.aspx. Not only did I want to maintain the same UI, but by looking at the "documentation" for NewListPage, I found that the trick, especially for a survey, is using CreateListFromRpc:
protected void BtnOk_Click(object sender, EventArgs args)
{
NameValueCollection queryString = this.Request.Form;
Uri nextUrl;
SPSite site = this.Web.Site;
Guid id = this.Web.ID;
SPUtility.ValidateFormDigest();
using (SPSite systemSite = new SPSite(site.ID, site.SystemAccount.UserToken))
{
using (SPWeb web = systemSite.OpenWeb(id))
{
SPList listFromRpc = web.Lists.CreateListFromRpc(queryString, out nextUrl);
SecureItem(web, web.AssociatedMemberGroup, listFromRpc, SPRoleType.Administrator);
}
}
string str2 = "Ribbon.List";
string str3 = "WSSListAndLibrary";
string str4 = nextUrl.ToString();
if (this.Web.UIVersion > 3)
str4 = AppendQueryStringParameterToUrl(AppendQueryStringParameterToUrl(str4, "InitialTabId", str2), "VisibilityContext", str3);
SPUtility.Redirect(str4, SPRedirectFlags.Default, this.Context);
}
Thanks to the reminder from @Vamsi that this page should not be in the layouts, I put this page in a feature, which I provisioned as follows:
<Module Name="Survey" Path="Modules">
<File Url="NewSurvey.aspx" Type="Ghostable" />
</Module>
<CustomAction
Id="ContributorNewSurvey"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Title="New Survey"
Description="Create a list of questions which you would like to have people answer."
ImageUrl="/_layouts/images/Survey.png"
Rights="AddListItems"
Sequence="225">
<UrlAction Url="~site/newsurvey.aspx"/>
</CustomAction>