internal void ParsePrivileges(Role role)
            {
                int size = base.dataBuffer[base.dataOffset++];
                role.privileges = new List<Privilege>(size);

                for (int i = 0; i < size; i++)
                {
                    Privilege priv = new Privilege();
                    priv.code = (PrivilegeCode)base.dataBuffer[base.dataOffset++];

                    if (priv.CanScope())
                    {
                        int len = base.dataBuffer[base.dataOffset++];
                        priv.ns = ByteUtil.Utf8ToString(base.dataBuffer, base.dataOffset, len);
                        base.dataOffset += len;

                        len = base.dataBuffer[base.dataOffset++];
                        priv.setName = ByteUtil.Utf8ToString(base.dataBuffer, base.dataOffset, len);
                        base.dataOffset += len;
                    }
                    role.privileges.Add(priv);
                }
            }
 /// <summary>
 /// Return privilege shallow clone.
 /// </summary>
 public Privilege Clone()
 {
     Privilege priv = new Privilege();
     priv.code = this.code;
     priv.ns = this.ns;
     priv.setName = this.setName;
     return priv;
 }
 private static bool FindRole(IList<Privilege> privileges, Privilege search)
 {
     foreach (Privilege privilege in privileges)
     {
         if (privilege.Equals(search))
         {
             return true;
         }
     }
     return false;
 }