我想做一个网站,想控每个用户的权限,具体是要控到对每个表里面的字段是否具有新建,查看,删除  
请高手给点点说法,具体要怎么做!  

解决方案 »

  1.   

    角色+字段列表+数值权限,效果应该不错数值权限的合并与判断using System;
    using System.Text;namespace HKH.Common
    {
    /// <summary>
    /// figure the privilege by number, the value must be power of 2.
    /// </summary>
    /// <res>
    /// Example : 1----browse, 2----addnew, 4----modify, 8----delete
    /// </res>
    public class Privilege
    {
    #region Constructor
    private Privilege()
    {
    }
    #endregion #region Methods /// <summary>
    /// Authenticate privilege
    /// </summary>
    /// <param name="holdPrivilege">hold privilege</param>
    /// <param name="privilege">privilege to authenticate </param>
    /// <returns></returns>
    public static bool Authenticate(int holdPrivilege, int privilege)
    {
    return holdPrivilege == (holdPrivilege | Convert.ToInt32(Math.Pow(2, privilege)));
    } /// <summary>
    /// Unite the privileges
    /// </summary>
    /// <param name="privileges"></param>
    /// <returns></returns>
    public static int Unite(int[] privileges)
    {
    if (null == privileges || 0 == privileges.Length)
    return 0; int result = 0; foreach (int privilege in privileges)
    {
    result |= privilege;
    } return result;
    } #endregion
    }
    }
      

  2.   

    http://blog.csdn.net/diy8187/archive/2008/04/15/2293586.aspx
    http://www.cnblogs.com/lijun4017/archive/2008/04/26/1172173.html     
        http://www.ithome-cn.net/technology/mis/mis80.htm用户,权限,角色
    权限加在角色身上,用户属于角色
      

  3.   

    http://www.noahweb.net/mail/2/Project.htm
        http://blog.csdn.net/diy8187/archive/2008/04/15/2293586.aspx
    http://www.cnblogs.com/lijun4017/archive/2008/04/26/1172173.html
    http://www.ithome-cn.net/technology/mis/mis80.htm