다음을 통해 공유


SecurityCallContext.DirectCaller 속성

정의

이 메서드의 직접 호출자를 설명하는 SecurityIdentity 개체를 가져옵니다.

public:
 property System::EnterpriseServices::SecurityIdentity ^ DirectCaller { System::EnterpriseServices::SecurityIdentity ^ get(); };
public System.EnterpriseServices.SecurityIdentity DirectCaller { get; }
member this.DirectCaller : System.EnterpriseServices.SecurityIdentity
Public ReadOnly Property DirectCaller As SecurityIdentity

속성 값

SecurityIdentity 값입니다.

예제

다음 코드 예제에서는 직접 호출자의 id를 확인 하려면이 메서드는 ServicedComponent 메서드.

// Get the employee's salary. Only the employee and managers can do this.
double GetSalary()
{
   if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) )
   {
      return (salary);
   }
   else
   {
      throw gcnew UnauthorizedAccessException;
   }
}
// Get the employee's salary. Only the employee and managers can do this.
public double GetSalary ()
{
    if ( SecurityCallContext.CurrentCall.DirectCaller.AccountName == accountName ||
         SecurityCallContext.CurrentCall.IsCallerInRole("Manager") )
    {
        return(salary);
    }
    else
    {
      throw new UnauthorizedAccessException();
    }
}
' Get the employee's salary. Only the employee and managers can do this.
Public Function GetSalary() As Double 
    If SecurityCallContext.CurrentCall.DirectCaller.AccountName = accountName OrElse SecurityCallContext.CurrentCall.IsCallerInRole("Manager") Then
        Return salary
    Else
        Throw New UnauthorizedAccessException()
    End If

End Function 'GetSalary

적용 대상