Platform SDK: Transaction Server

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).

Provided By

Context class

boolean isCallerInRole (
    String role
);

Parameters

role
[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.

See Also

Programmatic Security, Basic Security Methods, Secured Components