webCOMAND

repo::peek_user()

Return the current repository user, which is the user whose authorizations will be used to determine which objects are accessible, etc.

Prototype

User peek_user()

Return

The current repository user is returned, as a User object.

Example

$original_user = $repo->peek_user();

$user = $repo->get_first("FROM User WHERE OID=123");

// switch the "user of record" to user with OID 123
$index = $repo->push_user($user);
if($index == FALSE) {
    exit("Could not push user.");
}

echo("Switched from $original_user to $user.\n");

// get all contacts user with OID 123 can view
$contacts = $repo->get("SELECT Name FROM Contact");
foreach($contacts as $contact) {
	echo($contact->Name . "\n");
}

// return to previous "user of record"
$repo->pop_user($index);

See Also

switch_user(), pop_user(), push_user(), push_super_user()