I deleted my other post as I felt the direction was wrong. Instead, I want to use IsMember. However, I keep getting a null reference exception even though Visual Studio shows that all the parameters have data. I suspect one of the parameters are wrong.
Here’s my IsMember:
Dictionary<string, string> dic = QueryRoles();
if (SecurityAccess.IsMember(currentCameraItem.FQID.ServerId, loginSettings.UserIdentity, dic[“Administrators”]))
{
MessageBox.Show(“True”);
}
else
{
MessageBox.Show(“False”);
}
And here’s my QueryRoles, lifted directly from one of the plugin samples:
// The existing roles are children under of the RoleFolder
string roleFolderPath = String.Format(“/{0}”, ItemTypes.RoleFolder);
var roleConfigItems = configurationApiClient.GetChildItems(roleFolderPath);
var roles = new Dictionary<string, string>();
foreach (var role in roleConfigItems)
{
roles.Add(role.DisplayName, role.Path);
}
return roles;
Breaking at the SecurityAccess line, the currentCameraItem.FQID.ServerId has a lot of properties pointing to my server, loginSettings.UserIdentity has a string that starts with S-1-5-21 and dic[“Administrators”] returns Role[1f30d14b-ba91-4e8a-8838-eda17931f8fc].