Here is an utility for translating permission masks in hex to SPBasePermissions values.Click below to download.
The core of the thing:
private void button1_Click(object sender, EventArgs e)
{
string userValue = textBox1.Text;
listBox1.Items.Clear();
long valueOriginal = long.Parse(userValue, NumberStyles.AllowHexSpecifier);
long value = valueOriginal;
int rbit = 0;
do
{
int i = (int)(value % 2);
long bitcheck = 1 << rbit;
if (i > 0) // it matches
{
string name = "" + ((SPBasePermissions)bitcheck);
string formatString = String.Format("{0,10:X}", bitcheck);
Console.WriteLine(name + " " + formatString);
listBox1.Items.Add(name + " " + formatString);
}
value = value >> 1;
rbit++;
} while (value > 0);
}
A screenshot:
No comments:
Post a Comment