- ⌂ repo
- Methods
- Constructor
- execute()
- get()
- get_content_type()
- get_first()
- get_object()
- get_object_by_id()
- get_object_by_oid()
- get_object_by_doid()
- get_object_by_uuid()
- get_objects_by_id()
- get_objects_by_oid()
- get_objects_by_doid()
- get_objects_by_uuid()
- get_root()
- get_row()
- get_rows()
- get_system_property()
- log_alert()
- log_critical()
- log_to_file()
- log_to_html()
- new_collection()
- new_object()
- peek_user()
- pop_user()
- push_super_user()
- push_user()
- query()
- supports_dimensions()
- switch_user()
- uninit()
- with()
repo::push_user()
Switch the repository "user of record". All subsequent queries performed on this repository will apply the new user's authorizations until pop_user() is called.
Prototype
integer push_user(Object $user, boolean $user_of_record = FALSE)
Parameter
- user - A User Object that represents the new "user of record".
- user_of_record - If TRUE, make this new user the "user of record" like switch_user() will do automatically.
Return
If 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() or push_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 user with OID 123
$index = $repo->push_user($user);
if($index == FALSE) {
exit("Could not push 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);