security_check_session_saved_user_key

 
          security_check_session_saved_user_key(string $session_user_key, bool $check_if_numeric )  
This is one of the session verification methods, it configures your report to check whether or not the session of the user (who is trying to access it) has a given key (such as the active user-id) and if this key does not exist in the session, the user should be redirected to the login page that you passed to the "security_init" method.
So, this method is meant to be helpful if you are using a login page in your project, for validating the login credentials of each user, and if these credentials are valid, you store a certain key (probably, the active user_id) in the session, and you want Smart Report Engine to only allow users whose sessions have this key to access your report.
# This method is exclusive to the commercial edition and is not supported in the community edition .

# Note

All session verification methods start with

# Parameters

Parameter Description
$session_user_keyA session key in your project (for example "user_id") that you want the engine to check for its existence in the session before allowing any access to your private report.
$check_if_numeric If this parameter is true, the engine will also check if the value of the "$session_user_key " is a numeric value. If this parameter is omitted, false 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;
 }