Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.security.permissions   Previous This
Package
Next

 


Class UserFileIOAccess

public class UserFileIOAccess implements ISecurityRequest
{
  // Fields
  public static final int READ;
  public static final int READWRITE;
  public static final int WRITE;

  // Constructors
  public UserFileIOAccess(int accessType);

  // Methods
  public int getAccessFlags();
  public PermissionID getPermissionID();
  public String toString ();
  public static boolean validAccessType(int acc);
}

This class represents a request to perform a user-directed file I/O operation. UserFileIOAccess instances are intended to be used as the security request objects for parameterized security checks involving the user-directed file I/O permission. The UserFileIOPermission.check method expects a UserFileIOAccess object as its parameter.

The following example shows how to use a UserFileIOAccess object to check permission for user-directed file I/O operations.


  ... 
  // Create a UserFileIOAccess object that indicates that you
  // want to ask the user to choose a file to open for reading.

  UserFileIOAccess sreq = new UserFileIOAccess(UserFileIOAccess.READ);

  // Check to see that all of your callers have the rights to
  // initiate user-directed file operations for reading.

  PolicyEngine.checkPermission(sreq);  
  ...
	

For more information about checking file I/O permissions, see the PolicyEngine class and the UserFileIOPermission class.

Constructors

UserFileIOAccess

public UserFileIOAccess(int accessType);

Creates a new UserFileIOAccess object that represents the specified access types.

ParameterDescription
accessType The requested access type. The value must be READ, WRITE, or READWRITE.

Methods

getAccessFlags

public int getAccessFlags();

Retrieves the access flags represented by the UserFileIOAccess object.

Return Value:

Returns the access flags represented by the UserFileIOAccess object.

getPermissionID

public PermissionID getPermissionID();

Retrieves the permission identifier associated with the UserFileIOAccess object. This method satisfies the ISecurityRequest interface and returns PermissionID.USERFILEIO to indicate that instances of the UserFileIOAccess class are associated with the user-directed file I/O permission.

Return Value:

Returns PermissionID.USERFILEIO.

toString

public String toString ();

Converts the UserFileIOAccess object to its string representation.

Return Value:

Returns the string representation of the UserFileIOAccess object.

validAccessType

public static boolean validAccessType(int acc);

Determines whether the access flags in the specified integer are valid UserFileIOAccess flags.

Return Value:

Returns true if the access type is valid; otherwise, returns false.

ParameterDescription
acc The access type that is checked for validity.

Fields

READ
The value indicating that a file needs to be opened for reading.
READWRITE
The value indicating that a file needs to be opened for both reading and writing.
WRITE
The value indicating that a file needs to be opened for writing.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.