canAccessFolder(userName: String; folderPath: String): Integer;
The canAccessFolder method of the JadeReportWriterSecurity class returns the type of access that the user specified in the userName parameter has to the folder specified in the folderPath parameter when the user attempts to access that folder.
By default, users have full access to folders in the JADE Report Writer Configuration application. When the return value of this method is checked at the time the folder is accessed, the folder is not displayed if the user has no access. If the user has read-only access, contents of the folder are displayed in read-only mode and the user cannot change values.
The folder path is built from the folder names at each level in the hierarchy, separated by a forward slash character (/). Template paths start with a forward slash, but report paths do not. For example:
A folder named Common within a folder named Payroll within the root report folder named Reports has a folder path of Reports/Payroll/Common.
A folder named Secured within a folder named Sales within the root template folder named Templates has a folder path of /Templates/Sales/Secured.
The following example shows the canAccessFolder method to control access to folders.
canAccessFolder(userName: String; folderPath: String): Integer; begin if folderPath = "/Reports/Clients" then if process.userCode = "USER1" or process.userCode = "USER2" then return 2; else return 0; endif; else return 2; endif; end;
In this example, USER1 and USER2 have full access to the Clients folder. All other users have no access to the Clients folder but they have full access to folders other than the Clients folder.
For details about the integer values that can be returned by this method, see "JadeReportWriterSecurity Class Constants", earlier in this chapter.