Jump to content
We've recently updated our Privacy Statement, available here ×

How I did to have a report as home page for a ROLE


Gaby38

Recommended Posts

Hello

As I said in a previous post, I was not able to reply to a question about this theme via the forum tool, so I try to post it as a new thread. Perhaps it will work.

I am not a Jasperserver "guru" : the way I used is perhaps not the better one but it works. It's for your information if interested :

I don't know if it is possible to have a specific home page by user but I did that for a "ROLE". I mean that a logging user goes on a specific existing report (dashboard for example) according to his ROLE.

To do that, the general mechanism is to "force" this report as home page instead of the repository view.

First, I edited the file "jasperserver-servlet.xml" in WEB-INF directory to add the new home page vs the ROLEs:

        <property name="homePageByRole">
            <list>
                <value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repositoryExplorerFlow</value>
                <value>ROLE_USER|redirect:/flow.html?_flowId=repositoryExplorerFlow</value>
                <value>ROLE_EVADE|redirect:/flow.html?_flowId=viewEvadeFlow</value>
                <value>ROLE_KIMOCE|redirect:/flow.html?_flowId=viewKimoceFlow</value>
            </list>
        </property>

The new "flow files" viewEvadeFlow and viewKimoceFlow are clones of repositoryExplorerFlow in which the report wanted as home page ( EVADEWelcome)  is forced :

<action-state id="checkForParams">
        <set attribute="reportUnit" value="${'/reports/EVADE/EVADEWelcome'}" scope="flow"/>
        <action bean="viewReportAction"/>
        <transition on="yes" to="showInputControls"/>
        <transition on="no" to="verifyData">
            <attribute name="requestParsed" value="true" type="java.lang.Boolean"/>
        </transition>
    </action-state>

But you have also to modify the security rules according to new ROLES and "flow files" in "applicationContext-security.xml"

 <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager"><ref bean="authenticationManager"/></property>
        <property name="accessDecisionManager"><ref local="httpRequestAccessDecisionManager"/></property>
        <!-- <property name="runAsManager"><ref bean="runAsManager"/></property>  -->
        <property name="objectDefinitionSource">
            <value>
                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                PATTERN_TYPE_APACHE_ANT
                /login.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /logout.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE,IS_AUTHENTICATED_FULLY
                /loginerror.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_EVADE,ROLE_KIMOCE,ROLE_ADMINISTRATOR
                /exituser.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR,IS_AUTHENTICATED_FULLY
                /home.html=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /flow.html=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /loginsuccess.html=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /listolapviews.html=ROLE_USER,ROLE_ADMINISTRATOR
                /fillparams.html=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /j_acegi_switch_user*=ROLE_ADMINISTRATOR
                /fileview/**=ROLE_USER,ROLE_ADMINISTRATOR
                /olap/**=ROLE_USER,ROLE_ADMINISTRATOR
                /xmla=ROLE_USER,ROLE_ADMINISTRATOR
                /services/**=ROLE_USER,ROLE_ADMINISTRATOR
                /reportimage/**=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                /jrpxml/**=ROLE_USER,ROLE_ADMINISTRATOR
          </value>
       </property>
    </bean>

and further in the same file :

 <bean id="flowVoter" class="com.jaspersoft.jasperserver.war.security.FlowRoleAccessVoter">
        <property name="flowAccessAttribute" value="FLOW_ACCESS"/>
        <property name="flowDefinitionSource">
            <value>
                repoAdminFlow=ROLE_ADMINISTRATOR
                userListFlow=ROLE_ADMINISTRATOR
                roleListFlow=ROLE_ADMINISTRATOR
                reportUnitFlow=ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
                olapUnitFlow=ROLE_ADMINISTRATOR
                olapClientConnectionFlow=ROLE_ADMINISTRATOR
                mondrianXmlaSourceFlow=ROLE_ADMINISTRATOR
                editFolderFlow=ROLE_ADMINISTRATOR
                fileResourceFlow=ROLE_ADMINISTRATOR
                dataTypeFlow=ROLE_ADMINISTRATOR
                listOfValuesFlow=ROLE_ADMINISTRATOR
                queryFlow=ROLE_ADMINISTRATOR
                reportDataSourceFlow=ROLE_ADMINISTRATOR
                inputControlsFlow=ROLE_ADMINISTRATOR
                objectPermissionToRoleFlow=ROLE_ADMINISTRATOR
                userEditFlow=ROLE_ADMINISTRATOR
                roleEditFlow=ROLE_ADMINISTRATOR
                queryReferenceFlow=ROLE_ADMINISTRATOR
                objectPermissionToUserFlow=ROLE_ADMINISTRATOR
                repositoryExplorerFlow=ROLE_USER,ROLE_ADMINISTRATOR
                *=ROLE_USER,ROLE_ADMINISTRATOR,ROLE_EVADE,ROLE_KIMOCE
            </value>
        </property>
    </bean>

If you do "searches" on this forum you will find other ways to do that .

I hope this will help you
 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 1 month later...

This approach for setting the home page looks cumbersome. I think it would have been easier to replace repositoryExplorerFlow with your own flow that had the logic in it to switch home pages.

 

Multi-tenancy is a many tenacled beast, including requirements such as:

  • restricting repository access
  • tenant/customer, user and role management
  • user preferences, including setting a home page
  • clustering, scalability

Jaspersoft has helped many customers implement multi-tenant solutions with services.

In the next JasperServer Professional release, we are taking what we have learned and putting multi-tenant features into the core product.

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...