Exemple #1
0
 /// <summary>
 /// 当前用户是否具有某项权限值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="Me"></param>
 /// <param name="right">权限枚举值</param>
 /// <returns></returns>
 public static bool ContainDroit <T>(this Me Me, T right) where T : struct
 {
     Bzure.Security.Permissions.Droit      droit     = new Bzure.Security.Permissions.Droit(right.GetType().FullName);
     Bzure.Security.Permissions.AccessCode droitCode = new Bzure.Security.Permissions.AccessCode(Convert.ToInt32(right));
     droit.AddAccessCode(droitCode);
     return(Me.Authorize(droit));
 }
Exemple #2
0
        public IDroit Copy()
        {
            Droit droit = new Droit(this.Guid.ToString());

            foreach (IAccessCode at in this._accessTypes)
            {
                droit.AddAccessCode(at.Copy());
            }
            return(droit);
        }
Exemple #3
0
 public override bool Equals(object obj)
 {
     if (obj is Droit)
     {
         Droit oDroit = obj as Droit;
         bool  same   = true;
         same = same && this._guid.CompareTo(oDroit._guid) == 0;
         same = same && this._accessTypes.Count == oDroit._accessTypes.Count;
         foreach (IAccessCode at in this._accessTypes)
         {
             same = same && oDroit.Contains(at);
         }
         return(same);
     }
     return(base.Equals(obj));
 }
Exemple #4
0
 public IDroit Copy()
 {
     Droit droit = new Droit(this.Guid.ToString());
     foreach (IAccessCode at in this._accessTypes)
         droit.AddAccessCode(at.Copy());
     return droit;
 }