2010-01-14 90 views
0

我以系统帐户登录,因此它可能不是“真正的访问被拒绝”! 我所做的: - 自定义主页 - 从一个自定义的内容类型的自定义页面布局(自定义字段)Sharepoint:编辑页面(由于页面布局)或列表项目时拒绝访问

如果我在SPD的工具添加自定义字段(又名“内容字段” )在我的页面布局中,当我尝试编辑来自该页面布局的页面时,我的访问被拒绝。

因此,举例来说,如果我在页面布局加上此行的“ASP:内容”标签: 我得到拒绝访问。如果我删除它,everyting很好。 (“测试”字段是来自内容类型的字段)。

有什么想法?

UPDATE

嗯,我想在一个空白的网站,它工作得很好,所以一定是坏了我的web应用程序:(

更新#2

外貌像母版页中的这一行给我的访问被拒绝:

<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Visible="false" 
    PrefixHtml="&lt;tr&gt;&lt;td colspan=&quot;0&quot; id=&quot;mpdmconsole&quot; class=&quot;s2i-consolemptablerow&quot;&gt;" 
    SuffixHtml="&lt;/td&gt;&lt;/tr&gt;"></SharePoint:DelegateControl> 

更新#3

我发现http://odole.wordpress.com/2009/01/30/access-denied-error-message-while-editing-properties-of-any-document-in-a-moss-document-library/

看起来像一个类似的问题。但是我们的Sharepoint版本与最新的更新。我会尝试使用应该修复列表并发布另一个更新的代码。

**更新#4 **

OK ......我想,我发现网页上面(见链接)的代码,它似乎解决的事情。我还没有在100%测试解决方案,但到目前为止,这么好。下面是我的一个功能接收器使得代码(我用从上面的链接发布的代码):

using System; 
using System.Collections.Generic; 
using System.Text; 
using Microsoft.SharePoint; 

using System.Xml; 

namespace MyWebsite.FixAccessDenied 
{ 
    class FixAccessDenied : SPFeatureReceiver 
    { 
     public override void FeatureActivated(SPFeatureReceiverProperties properties) 
     { 
      FixWebField(SPContext.Current.Web); 
     } 

     public override void FeatureDeactivating(SPFeatureReceiverProperties properties) 
     { 
      //throw new Exception("The method or operation is not implemented."); 
     } 

     public override void FeatureInstalled(SPFeatureReceiverProperties properties) 
     { 
      //throw new Exception("The method or operation is not implemented."); 
     } 

     public override void FeatureUninstalling(SPFeatureReceiverProperties properties) 
     { 
      //throw new Exception("The method or operation is not implemented."); 
     } 

     static void FixWebField(SPWeb currentWeb) 
     { 

      string RenderXMLPattenAttribute = "RenderXMLUsingPattern"; 

      SPSite site = new SPSite(currentWeb.Url); 
      SPWeb web = site.OpenWeb(); 

      web.AllowUnsafeUpdates = true; 
      web.Update(); 

      SPField f = web.Fields.GetFieldByInternalName("PermMask"); 
      string s = f.SchemaXml; 
      Console.WriteLine("schemaXml before: " + s); 
      XmlDocument xd = new XmlDocument(); 
      xd.LoadXml(s); 
      XmlElement xe = xd.DocumentElement; 
      if (xe.Attributes[RenderXMLPattenAttribute] == null) 
      { 
       XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute); 
       attr.Value = "TRUE"; 
       xe.Attributes.Append(attr); 
      } 

      string strXml = xe.OuterXml; 
      Console.WriteLine("schemaXml after: " + strXml); 
      f.SchemaXml = strXml; 

      foreach (SPWeb sites in site.AllWebs) 
      { 
       FixField(sites.Url); 
      } 

     } 

     static void FixField(string weburl) 
     { 
      string RenderXMLPattenAttribute = "RenderXMLUsingPattern"; 

      SPSite site = new SPSite(weburl); 
      SPWeb web = site.OpenWeb(); 
      web.AllowUnsafeUpdates = true; 
      web.Update(); 

      System.Collections.Generic.IList<Guid> guidArrayList = new System.Collections.Generic.List<Guid>(); 

      foreach (SPList list in web.Lists) 
      { 
       guidArrayList.Add(list.ID); 
      } 

      foreach (Guid guid in guidArrayList) 
      { 
       SPList list = web.Lists[guid]; 
       SPField f = list.Fields.GetFieldByInternalName("PermMask"); 
       string s = f.SchemaXml; 
       Console.WriteLine("schemaXml before: " + s); 
       XmlDocument xd = new XmlDocument(); 
       xd.LoadXml(s); 
       XmlElement xe = xd.DocumentElement; 
       if (xe.Attributes[RenderXMLPattenAttribute] == null) 
       { 
        XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute); 
        attr.Value = "TRUE"; 
        xe.Attributes.Append(attr); 
       } 
       string strXml = xe.OuterXml; 
       Console.WriteLine("schemaXml after: " + strXml); 
       f.SchemaXml = strXml; 
      } 

     } 

    } 
} 

只是把这些代码作为一个功能接收器,并在根网站,它应该循环槽全部激活子网站和修复列表。

摘要

你得到编辑PAGEITEM

你仍然可以获得即使你身份登录的超级管理员的错误时拒绝访问在世界f ****(对不起,我花了3天的那个bug)

对我来说,它发生在从另一个网站定义(cmp文件)导入后

实际上,它应该是一个已知的bug,它应该从2009年2月开始被修复,但它看起来不是。

我在上面发布的代码应该修复这个问题。

+0

我使用MOSS 2K7的方式 – tinky05 2010-01-14 15:08:18

+0

和 http://social.technet.microsoft.com/Forums/en-CA/sharepointgeneral/thread/4d0578f8-f6f2-480a-8a63-737ac102cf98 也 – tinky05 2010-01-20 18:17:28

回答

0

查看我在帖子编辑中发布的代码。它解决了我的问题。

0

尝试发布您的母版页面布局,这是最常见的原因。由于系统帐户是godmode,它不会得到该错误。

在SharePoint Designer你不能这样做在发布工作流(审批)的最后一步,所以你:

SharePoint设计:
签入=>发布主要版本,点击OK按钮或者点击/ _catalogs /网站上的masterpage。

然后使用上下文菜单批准母版页和布局。

+0

我aldreay尝试过。我将从头开始,然后再试一次:( – tinky05 2010-01-14 18:04:19

0

一些想法:

  • 检查您的自定义页面布局和母版页的任何Web部件未注册为安全。
  • 您是否定义了自己的自定义字段类型,如编写扩展SPField的类?如果是这样,您是否使用自定义字段控制?如果你是,检查它是否正在做任何可能需要提升特权的东西。
  • 同样,检查任何包含Web控件的Web部件的编辑模式面板,这些Web控件可能试图做某些需要提升权限的事情。
+0

目前我的页面布局中没有webpart 而我的自定义字段只是内容类型(一个常见的HTML字段)中的一个新列,不要为它写任何代码 – tinky05 2010-01-15 16:28:16

0

该问题似乎是由某些版本的SharePoint中的stsadm -o export函数中的错误(我从2007 RTM MOSS服务器执行导出操作)导致的。导入伪造的导出文件会导致所有NEWLY-CREATED列表中的“编辑拒绝访问”问题。稍后版本的修补程序修复了stsadm -o export,但不要修复损坏的列表;这需要像tinky05的程序。