security_init

 
          security_init($login_page = Configs::SRE__DEFAULT_LOGIN_PAGE_, $logout_page = Configs::SRE__DEFAULT_LOGOUT_PAGE_, $session_name=Configs::SRE_DEFAULT_SESSION_NAME)  
This security method should be used to set the main security parameters for private reports. These security parameters are the login page to which the engine should redirect any unauthorized users, the logout page to which the engine should redirect users when they click the "logout" link on the report's menu and the session name which is used in your project. If any of these parameters are omitted, their default values, which you can find in the engine configuration file will be used.
This method should only used for private reports, and after calling it, you should call one or more of the session verification methods to define all the session validations that you want Smart Report Engine to perform before allowing any access to your private report.
# This method is exclusive to the commercial edition and is not supported in the community edition .

# Parameters

Parameter Description
$login_pageThe URL of the login page, which the engine should use to redirect any unauthorized users. If this parameter is omitted, the default login page (in the engine configuration file) will be used.
$logoutThe URL of the logout page, which the engine should use to redirect your users when they click the "logout" link from the report's menu. If this parameter is omitted, the default logout page (in the engine configuration file) will be used.
$session_nameThe name of the session, which is used in your project (e.g. PHPSESSID). If this parameter is omitted, the default session name (that you can find in the engine configuration file) will be used.

# Returns

This method returns the calling object, so it can be chained with other methods in the ‘ReportOptions’ class

# Code Example

 
           $report = new ReportOptions(SRE_PRIVATE_REPORT);
 $report->select_tables(array("items"))
        ->select_all_fields()
        ->security_init("some_login_page_url","some_logout_page_url","project1")
        ->security_check_session_saved_user_key("user_id")
        ->security_check_session_saved_group_key("group", array("sales", "admins"));   
 $engine = new CustomEngine($report);
 $report_path = $engine->create_report();
 if ($report_path) {
    echo "Your report URL:" . $report_path;
 }