Code access security

For the series viewer to run on the client machine, it needs to have appropriate permissions. Options available through .NET framework utilities are insuffisint. For example, using the .NET Administration Console to create a deployment package will replace all policies that exist on the client machine.

Therefore, a permission set utility is included in the Medical Web Viewer. This gives the series viewer control full access to the client’s machine, by adding a new Code Group under the “Machine” policy level, as shown below

Figure-7 Microsoft .NET Framework Configuration Manager

The utility achieves makes that addition as follows:

public static void CreateCodeGroup(PermissionSetAttributes permissionSetAttributes)
{   // move to machine level 
  PolicyLevel machinePolicyLevel = GetLevel(permissionSetAttributes.Level); 
  PermissionSet ps =machinePolicyLevel.GetNamedPermissionSet(permissionSetAttributes.Permission);
  // Create the membership condition for the codegroup 
  IMembershipCondition mc = new UrlMembershipCondition(permissionSetAttributes.Url); 
  PolicyStatement policy = new PolicyStatement(ps,PolicyStatementAttribute.Nothing); 
  // Create the codegroup 
  CodeGroup cg = new UnionCodeGroup(mc, policy); 
  cg.Description = permissionSetAttributes.Description; 
  cg.Name = permissionSetAttributes.Name;  
  machinePolicyLevel.RootCodeGroup.AddChild(cg); 
  // Save changes 
  SecurityManager.SavePolicyLevel(machinePolicyLevel);
}