security_init
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)
Parameter | Description |
---|---|
$login_page | The 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. |
$logout | The 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_name | The 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. |
$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;
}