The BizTalk RFID provides a security mechanism called device-level security. Users who are registered as device admins (entity admins) are by default permitted to execute all methods of DeviceManagerProxy class.
By obtaining the instance of this class the one can perform any administrative operation on device and execute any sync command. Sometimes it is also required (or in general possible) to execute some sync commands by using of device manager proxy instance, which are not necessarily an administrative task. In this case the caller does not have to be a device-admin, but sotemies it should. For example, following
example shows how to execute command by using of the proxy class:
DeviceManagerProxy proxy = new DeviceManagerProxy(m_Host);
Guid connId = proxy.OpenConnection("mydevice");
proxy.ExecuteCommandForConnection("mydevice", "source", connId, cmd);
Depending on what 'cmd' is, admin permission can be required or not. For none-administrative tasks I use rather following example:
using (DeviceConnection connection = new DeviceConnection("Host", "Device"))
{
connection.Open();
Command cmd = connection.ExecuteCommand(null, rfidCommand, null);
. . .
}
Following picture illustrates how to add a user in the list of device administrators.
To get a feeling what methods are implemented in DeviceManagerProxy, here is a list of all methods:
[Serializable]
public sealed class DeviceManagerProxy : ProxyBase, IDeviceManager
{
public DeviceManagerProxy();
public DeviceManagerProxy(string host);
public void AddDevice(DeviceDefinition device, string parentDeviceGroup, bool addInOfflineMode);
public void AddDeviceEntitySecurityRecord(string deviceEntity, string accountName, DeviceEntitySecurityPrivilege privilege);
public FirmwareComparisonInformation CheckFirmwareCompatibility(string deviceName, string firmwareLocation);
public void CheckpointDevice(string deviceName);
public void CloseConnection(string deviceName, Guid connectionId);
public void CreateDeviceGroup(DeviceGroupDefinition deviceGroupDefinition, string parentDeviceGroupName);
public void DeleteDevice(string deviceName);
public void DeleteDeviceGroup(string deviceGroup);
public void DisableDevice(string deviceName);
public void EnableDevice(string deviceName);
public Command ExecuteCommandForConnection(string deviceName, string sourceName, Guid connectionId, Command command);
public Command ExecuteDedicatedCommand(string deviceName, Command command);
public DeviceDefinition[] GetAllDevices();
public Collection<DeviceGroupDefinition> GetAllSubDeviceGroups(string deviceGroup);
public string[] GetAllSubDevices(string deviceGroup);
public DeviceStatus GetCurrentDeviceStatus(string deviceName);
public DeviceDefinition GetDevice(string deviceName);
public Collection<DeviceCapability> GetDeviceCapabilities(string deviceName);
public DeviceEntitySecurity GetDeviceEntitySecurity(string deviceEntity);
public Dictionary<PropertyKey, RfidDevicePropertyMetadata>
GetDevicePropertyMetadata(string deviceName, string propertyGroupName);
public DeviceStatus[] GetDeviceStatus(string[] deviceNames);
public DeviceVersion GetDeviceVersion(DeviceVersionInfo info);
public Collection<DeviceVersionInfo> GetDeviceVersionInfos(string deviceName);
public DeviceVersion[] GetLatestDeviceVersions(string[] deviceNames);
public Collection<TagPrintedEvent> GetPrintStatus(string deviceName);
public string[] GetPropertyGroupNames(string deviceName);
public bool GetSecurityInheritance(string deviceEntity);
public Dictionary<string, PropertyProfile> GetSources(string deviceName);
public void KillConnection(string deviceName);
public void MoveEntityToDeviceGroup(string sourceDeviceEntity, string targetDeviceGroup);
public Guid OpenAdministrationConnection(string deviceName);
public Guid OpenConnection(string deviceName);
public void RebootDevice(string deviceName);
public void RemoveDeviceEntitySecurityRecord(string deviceEntity,
string accountName, DeviceEntitySecurityPrivilege privilege);
public void RemoveSecurityInheritance(string deviceEntity, bool copyEffectivePermissions);
public void RenameDevice(string oldName, string newName);
public void RenameDeviceGroup(string oldDeviceGroupName, string newDeviceGroupName);
public void SetSecurityInheritance(string deviceEntity);
public void UpdateDevice(DeviceDefinition device, bool includeAuthInfoInUpdate);
public void UpdateDeviceGroup(DeviceGroupDefinition deviceGroupDefinition);
public PropertyProfile ValidateConnection(UserDeviceInformation deviceInfo, AuthenticationInformation authInfo);
}
Related article: http://msdn.microsoft.com/en-us/library/bb749827.aspx
Posted
Jul 20 2008, 03:19 PM
by
Damir Dobric