SQL Server数据库控制视图页面的访问权限代码

[数据库] 时间:2025-11-05 07:24:18 来源:益强IT技术网 作者:数据库 点击:176次
SQL Server数据库控制视图页面的访问权限代码
复制Code highlighting produced by Actipro CodeHighlighter (freeware)   http://www.CodeHighlighter.com/   -->//----------------------------------------------------------------   //CodeArt   //   //文件描述:   //   //创 建 人: jianyi   //创建日期: 2008-7-11   //   //修订记录:    //   //----------------------------------------------------------------   using System;   using System.Collections.Generic;   using System.Collections;   using System.ComponentModel;   using System.Text;   using System.Web;   using System.Web.UI;   using System.Web.UI.WebControls;   using System.Web.UI.WebControls.WebParts;   using System.Web.UI.HtmlControls;   using Microsoft.SharePoint;   using System.Collections.Specialized;   using Microsoft.SharePoint.Utilities;    namespace ShareOffice.WebParts   {   public class RightControlPart : WebPart   {   private string _Groups = "";   [WebBrowsable]   [WebDescription("有权访问的数视图组,用;间隔")]   [Personalizable(PersonalizationScope.Shared)]   public string Groups   {   get { return _Groups; }   set { _Groups = value; }   }   protected override void OnLoad(EventArgs e)   {   base.OnLoad(e);   this.Title = "";   base.ChromeType = PartChromeType.None;   SPUser user = SPContext.Current.Web.CurrentUser;   //管理员可以访问   if (user.IsSiteAdmin && String.IsNullOrEmpty(this.Groups))   return;   //检测用户是网站模板否属于配置的免费信息发布网组   string[] arr = this._Groups.Split(;);   StringCollection userGroups = new StringCollection();   foreach (SPGroup g in user.Groups)   {   userGroups.Add(g.Name.ToLower());   }   foreach( string g in arr )   {   if (userGroups.Contains(g.ToLower()))   return;   }   SPUtility.TransferToErrorPage("您没有权限访问此视图.");   }   }   }  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.b2b供应网

(责任编辑:IT科技)

    相关内容
    精彩推荐
    热门点击
    友情链接