Platform SDK: Transaction Server

IObjectContext.IsCallerInRole Method

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

Indicates whether an object's direct caller is in a specified role (either individually or as part of a group).

New applications should call isCallerInRole.

Provided By

IObjectContext

boolean IsCallerInRole (
    String bstrRole
);

Parameters

bstrRole
[in] The name of the role in which you want to determine whether the caller is acting.

Return Values

true
Either the caller is in the specified role, or security is not enabled.

false
The caller is not in the specified role.

Remarks

You use this method to determine whether the direct caller of the currently executing method is associated with a specific role. A role is a symbolic name that represents a user or group of users who have specific access permissions to all components in a given package. Developers define roles when they create a component, and roles are mapped to individual users or groups at deployment time.

IsCallerInRole only applies to the direct caller of the currently executing method. (The direct caller is the process calling into the current server process. It can be either a base client process or a server process.) IsCallerInRole doesn't apply to the process that initiated the call sequence from which the current method was called, or to any other callers in that sequence.

Because IsCallerInRole returns true when the object that invokes it is executing in a client's process, it's a good idea to call IsSecurityEnabled before calling IsCallerInRole. If security isn't enabled, IsCallerInRole won't return an accurate result.

Example

See Also

Programmatic Security, Basic Security Methods, Secured Components