IsImpersonating
PowerScript function
Description
Queries whether a COM object running on COM+ is impersonating the
client.
Applies to
TransactionServer objects
Syntax
|
1 |
transactionserver.IsImpersonating ( ) |
|
Argument |
Description |
|---|---|
|
transactionserver |
Reference to the TransactionServer service instance |
Return value
Boolean.
Returns true if the component is impersonating the client and false
if it is not.
Usage
COM objects running on COM+ can use the ImpersonateClient function
to run in the client’s security context so that the server process has
access to the same resources as the client. Use IsImpersonating to
determine whether the ImpersonateClient function has been called without a
matching call to RevertToSelf.
Examples
The following example creates an instance of the TransactionServer
service and checks whether the COM object is currently running on the
client’s security context. If it is not, it impersonates the client,
performs some processing using the client’s security context, then reverts
to the object’s security context:
|
1 2 3 4 5 6 7 8 9 10 |
TransactionServer txninfo_test integer li_rc li_rc = GetContextService( "TransactionServer", & txninfo_test ) IF NOT txninfo_test.IsImpersonating() THEN txninfo_test.ImpersonateClient() END IF // continue processing as client txninfo_test.RevertToSelf() |
See also