Use the MODE field to specify the required permissions.
Mode criteria are usually used in combination with name-based, location-based, or content-based data typing. They allow you to limit a data type to a file or directory, or to specify the required read, write, and execute permissions.
The MODE field can include logical operators (Table 13–4) and characters (Table 13–5).
Table 13–4 MODE Field Logical Operators and Descriptions
Operator |
Description |
---|---|
! | |
& | |
| |
Table 13–5 MODE Field Characters and Descriptions
Character |
Description |
---|---|
The data type applies only to files |
|
The data type applies only to directories |
|
r |
The file is readable by any user |
The file is writable by any user |
|
The file is executable by any user |
|
The file is a link |
The default for a particular mode is that the mode does not matter.
The following mode fields restrict the data type as described:
f&!w—read-only files
!w—read-only files and directories
f&x—executable files
f&r&x—files that are both writable and executable
x|!w—files that are executable or read-only
The following data type definition creates an data type for read-only, non-executable files whose file names follow the naming convention *.doc. It assumes that a View action has been defined for the data type.
DATA_ATTRIBUTES ReadOnlyDocument { ICON read_only DESCRIPTION This document is not writable. Double- \ clicking runs your editor with a \ read-only copy of the file. ACTIONS View } DATA_CRITERIA ReadOnlyDocument_Criteria { NAME_PATTERN *.doc MODE !d&!x&!w DATA_ATTRIBUTES_NAME ReadOnlyDocument }