Customize Vizit DRM with the IFileDrmPlugin

With Vizit 6.1 comes the ability to write and register a custom DRM plugin for Vizit. This article walks you through the process of developing and registering a custom DRM plugin.

Getting Started

If you haven't already, take a look at this article and follow the instructions in it to get started writing your custom code: http://support.vizit.com/entries/52705159-Getting-Started-With-Vizit-APIs


The rest of this article will explain the details of how to write the specific code for the DRM plugin.

The Basics

Your Vizit install contains an assembly named Vizit.API.Interfaces. For custom DRM plugins, you must implement the IFileDrmPlugin interface which contains one methods and a property.

RedirectRule DetermineRedirectRule(SPFile file);

string Id { get; }

The following is the RedirectRule enumeration:

enum RedirectRule {
RedirectToPro,
RedirectToEssential,
NoRedirect
}

Implementing the IFileDrmPlugin Interface

As files are requested from your SharePoint server via their URL for download and the Vizit DRM feature is activated in your Web Application, Vizit watches for items that resolve to SharePoint documents. By default, Vizit will redirect any users that are in the groups specified on Vizit's Configure Settings page in Central Administration to either Vizit Essential or Vizit Pro depending on how it was configured. By implementing and deploying a custom IFileDrmPlugin, you will override this default behavior.

For items that resolve to SharePoint documents, Vizit passes the file along to your custom IFileDrmPlugin by calling DetermineRedirectRule. Based on information about the file and the current SharePoint context, you can determine whether the user should be redirected to Essential, Pro, or be permitted to download the document.

The following is an example DetermineRedirectRule implementation which redirects the user to Essential if the file resides in a list named "Test":

public RedirectRule DetermineRedirectRule(SPFile file)
{
if(file.Item.ParentList.Title == "Test") return RedirectRule.RedirectToEssential;
else return RedirectRule.NoRedirect;
}

As with every Vizit plugin, you must implement the getter of the Id property. The value of this may not change. It is the unique value identifying this plugin.

public string Id { get { return "Contoso.TestLibraryDrmPlugin"; } }
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk