#### Controlling user access to different export formats

JReport introduces an access control ability which can restrict different users to export report result to different formats.

##### How to realize the access control ability

You can restrict the report result formats for users by passing values to a variable. That is the global variable enableTypes in both customize_panel.jsp and save_result.jsp files in `<install_root>\public_html\dhtmljsp` folder. The value of enableTypes should be Integer, and JReport gives you the following integers to represent the corresponding report result types:

Report Result Format | Int. Value
--- | ---
HTML | 0
PDF | 1
Excel | 2
Text | 3
RTF | 4
XML | 5
PostScript | 6

You can specify a value or an array to enableTypes using the integers in the above table. Or you can also use the integers which are not mentioned above, but if you do so, the Int. values will be ignored, and do not function. That is to say, if you pass the array {1,2,5,9,-2} to enableTypes, 9 and -2 will be ignored and {1,2,5} will work, so PDF, EXCEL, XML formats can be in use.

##### Example

Assume that there are two users, user1 and user2. When user1 logs on, run a DHTML report set, he can only export the report result as PDF and HTML formats. While user2 can export the report result as RTF and XML formats when logging on. To realize it, you can use the following codes in customize_panel.jsp or save_result.jsp file:

    int[] enableTypes=null;
    String UserName=null;
    UserName=DHTMLUtil.getUserName(request);
    if(UserName.equalsIgnoreCase("user1"))
    enableTypes=new int[]{1,0};
    if(UserName.equalsIgnoreCase("user2"))
    enableTypes=new int[]{4,5};