auth::get_user_id (public)

 auth::get_user_id [ -level level ] [ -account_status account_status ]

Defined in packages/acs-authentication/tcl/authentication-procs.tcl

Get the current user_id with at least the level of security specified. If no user is logged in, or the user is not logged in at a sufficiently high security level, return 0.

Switches:
-level (optional, defaults to "ok")
-account_status (optional, defaults to "ok")
Returns:
user_id of user, if the user is logged in, 0 otherwise.
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth__get_user_id auth__get_user_id (test acs-authentication) auth::get_user_id auth::get_user_id test_auth__get_user_id->auth::get_user_id ad_conn ad_conn (public) auth::get_user_id->ad_conn security::https_available_p security::https_available_p (public) auth::get_user_id->security::https_available_p auth::require_login auth::require_login (public) auth::require_login->auth::get_user_id packages/acs-subsite/lib/user-info.tcl packages/acs-subsite/ lib/user-info.tcl packages/acs-subsite/lib/user-info.tcl->auth::get_user_id packages/acs-subsite/www/pvt/unsubscribe.tcl packages/acs-subsite/ www/pvt/unsubscribe.tcl packages/acs-subsite/www/pvt/unsubscribe.tcl->auth::get_user_id packages/acs-subsite/www/register/user-join.tcl packages/acs-subsite/ www/register/user-join.tcl packages/acs-subsite/www/register/user-join.tcl->auth::get_user_id

Testcases:
auth__get_user_id
Source code:
    set untrusted_user_id [ad_conn untrusted_user_id]

    # Do we have any user_id at all?
    if { $untrusted_user_id == 0 } {
        return 0
    }

    # Check account status
    if { $account_status eq "ok" && [ad_conn account_status] ne "ok" } {
        return 0
    }

    array set levelv {
        none 0
        expired 1
        ok 2
        secure 3
    }

    # If HTTPS isn't available, we can't require secure authentication
    if { ![security::https_available_p] } {
        set levelv(secure) 2
    }

    # Check if auth_level is sufficiently high
    if { $levelv([ad_conn auth_level]) < $levelv($level) } {
        return 0
    }

    return $untrusted_user_id
Generic XQL file:
packages/acs-authentication/tcl/authentication-procs.xql

PostgreSQL XQL file:
packages/acs-authentication/tcl/authentication-procs-postgresql.xql

Oracle XQL file:
packages/acs-authentication/tcl/authentication-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: