Extranet Project Filter

One nice feature with MicroStrategy Web is that you can point multiple web instances to a single IServer.  For example, if you have separate server implementations for Intranet and Extranet sites, you can manage them separately or load balance the web side while still utilizing the same physical IServer.  One consideration though is not all projects may be suitable for being exposed externally.  A classical setup may be that a Customer project is external, whereas Financial and HR projects should be internal.  Although you can easily control this via User Security, it does pose a slight risk to both have your projects exposed on the Extranet in case of a security error, or that a recently terminated employee could still access company data without access to the corporate network.
MicroStrategy doesn’t provide an option by Web to selectively load projects, but I was able to come up with a simple Web Addon to do so.  Some may find this useful, and at the very least, it’s a good example to get started with in the Java Web SDK.  This project was the precursor to my Single Project Login addon I recently posted about, so you’ll notice some similarities.
Overview
What this customization actually does is overwrite the ProjectsTransform and filter the projects from the getProjectsList() method.  In this way, we can prevent sensitive projects from being returned to the Projects Page and effectively prevent a user from accessing them. 

It should be noted that this isn’t true security, but rather security by concealment.  One could still access those projects by simply modifying the URL and typing in the clear text project name, assuming they really did have access to that project, and assuming they knew the name.  While in practice, this security is probably good enough, the limitations should be understood.

Steps To Create The Modification
1. Create a new transform that extends the current ProjectsTransform called CustomProjectsTransform.java.  List the projects that you want to keep or you can easily modify it to be exclusions.

package com.custom;
import com.microstrategy.web.app.ProjectInformation;
import com.microstrategy.web.app.transforms.ProjectsTransform;
import java.util.*;

public class CustomProjectsTransform extends ProjectsTransform
{
    public CustomProjectsTransform()
    {
        super();
    }

public ArrayList getProjectsList()
{
    ArrayList myListIn = super.getProjectsList();
    ArrayList myListOut = new ArrayList();
    for(int i=0; i< myListIn.size(); i++)
    {
    ProjectInformation projectInfo = (ProjectInformation)myListIn.get(i);
     if(projectInfo.getProjectDetails().getProjectName().equalsIgnoreCase("Proj1")==true)
    {
        myListOut.add(projectInfo);
    }
    else if(projectInfo.getProjectDetails().getProjectName().equalsIgnoreCase("Proj2")==true)
    {
        myListOut.add(projectInfo);
    }
    else if(projectInfo.getProjectDetails().getProjectName().equalsIgnoreCase("Proj3")==true)
    {
        myListOut.add(projectInfo);
    }
}
return myListOut;
}
}}

2.      Compile the class with the following command line:

   javac -source 1.4 -target 1.4 -classpath "C:Program FilesCommon FilesMicroStrategyWebObjects.jar;C:Program FilesCommon FilesMicroStrategyWebApp.jar;C:Program FilesCommon FilesMicroStrategyWebAppTransforms.jar;C:Program FilesCommon FilesMicroStrategyWebTransform.jar" -g CustomProjectsTransform.java

3.  Create a styleCatalog.xml file for the plugins:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE StyleCatalog SYSTEM "styleCatalog.dtd">
<StyleCatalog description="MSTR System Style Catalog" name="MSTRStyleCatalog" version="1.1">
<TransformDefns>
<TransformDefn class="com.custom.CustomProjectsTransform" name="CustomProjectsTransform"/> 

</TransformDefns>
<Styles>
   <Style description="Style: Display HTML for the projects that are currently available on the servers" name="ProjectsStyle" transform="CustomProjectsTransform"/>
</Styles>
</StyleCatalog>

4. Build your plugin

plugins
      ProjectFilter
           WEB-INF
                  xml
                       styleCatalog.xml
                  classes
                       com
                            custom
                                CustomProjectsTransform.class


5. Drop the ProjectFilter folder into your plugins folder, restart your web service and you’re good to go!

You may also like...