Export (0) Print
Expand All

IFtpRoleProvider::IsUserInRole Method

IIS 7.0

Checks to see whether a user is a member of a specific role.

HRESULT IsUserInRole(
   LPWSTR pszSessionId,
   LPWSTR pszSiteName,
   LPWSTR pszUserName,
   LPWSTR pszRole,
   long * pfIsInRole
)

Term

Definition

pszSessionId

[IN] A pointer to a string that contains the session ID.

pszSiteName

[IN] A pointer to a string that contains the site name.

pszUserName

[IN] A pointer to a string that contains the user name.

pszRole

[IN] A pointer to a string that contains the role name.

pfIsInRole

[OUT] A pointer to a long integer that is set to true if the user is in the role; otherwise, false.

An HRESULT. Possible values include, but are not limited to, those in the following table.

Value

Description

S_OK

Indicates that the operation was successful.

The following code example illustrates how to use the IFtpRoleProvider interface to create a custom authentication module for the FTP service that implements role checks.

public:
   STDMETHOD(IsUserInRole)(LPWSTR pszSessionId,
      LPWSTR pszSiteName,
      LPWSTR pszUserName,
      LPWSTR pszRole,
      long * pfIsInRole)
   {
      // Note: You would add your own custom logic here.
      CString strUserName = L"MyUser";
      CString strRoleName = L"MyRole";

      // Verify that the user name and role name are valid.
      // In this example, both the user name and
      // the role name are case-insensitive.
      if ((strUserName.CompareNoCase(pszUserName)==0) &&
          (strRoleName.CompareNoCase(pszRole)==0))
      {
         *pfIsInRole = TRUE;
      }
      else
      {
         *pfIsInRole = FALSE;
      }

      return S_OK;
   }

Type

Description

Client

IIS 7.5

Server

IIS 7.5

Product

FTP 7.5

Reference

ftpext.tlb

Community Additions

ADD
Show:
© 2014 Microsoft