webCOMAND

repo::push_super_user()

Push the super user onto the repository user stack.  All subsequent queries performed on this repository will apply the super user's authorizations until pop_user() is called, or while switch_user() or push_user() is called until the corresponding pop_user() is called.

If the current "user of record" is already a user with System Administrator checked, this method will return FALSE, rather than switching to the main super user.  To switch to the main super user, even if the current "user of record" is already a super user, use switch_user() or push_user() instead.

Prototype

integer push_super_user()

Return

If a super user (any user with System Administrator checked) is not already the repo user and the switch is successful, the number of users on the user stack is returned.  Otherwise FALSE is returned.  The number of users on the stack is incremented each time switch_user(), push_user() or push_super_user() is called successfully and decremented each time pop_user() is called.

Example

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

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

// 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(), peek_user(), pop_user(), push_user()