acs_user::get_by_username (public)

 acs_user::get_by_username [ -authority_id authority_id ] \
    -username username

Defined in packages/acs-tcl/tcl/community-core-procs.tcl

Returns user_id from authority and username. Returns the empty string if no user found.

Switches:
-authority_id (optional)
The authority. Defaults to local authority.
-username (required)
The username of the user you're trying to find.
Returns:
user_id of the user, or the empty string if no user found.

Testcases:
auth_authenticate, auth_create_user, auth_password_reset
Source code:

    if { $authority_id eq "" } {
        #
        # Get the default authority
        #
        set authority_id [auth::authority::get]
    }

    set key [list get_by_username  -authority_id $authority_id -username $username]

    while {1} {
        set user_id [ns_cache eval user_info_cache $key {
            set user_id [acs_user::get_by_username_not_cached  -authority_id $authority_id  -username $username]
            #
            # Don't cache results from invalid usernames.
            #
            if {$user_id eq ""} {
                break
            }
            return $user_id
        }]
        break
    }

    return $user_id
Generic XQL file:
packages/acs-tcl/tcl/community-core-procs.xql

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

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

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