FilePermissions
public interface ConfigurableFilePermissions extends FilePermissions
For details on classes of users and file/directory permissions see FilePermissions
.
An example usage of this functionality would be configuring a copy task and explicitly specifying the destination file permissions:
from(...) into(...) filePermissions { user { read = true execute = true } other.execute = false }
Modifier and Type | Method | Description |
---|---|---|
ConfigurableUserClassFilePermissions |
getGroup() |
Returns the permissions a user, who is a member of the group that the file/directory belongs to, has for the file/directory.
|
ConfigurableUserClassFilePermissions |
getOther() |
Returns the permissions all other users (non-owner, non-group) have for the file/directory.
|
ConfigurableUserClassFilePermissions |
getUser() |
Returns the permissions the owner of the file has for the file/directory.
|
void |
group(Action<? super ConfigurableUserClassFilePermissions> configureAction) |
Modifies the permissions a user, who is a member of the group that the file/directory belongs to, has for the file/directory.
|
void |
other(Action<? super ConfigurableUserClassFilePermissions> configureAction) |
Modifies the permissions all other users (non-owner, non-group) have
for the file/directory.
|
void |
unix(int unixNumeric) |
Sets Unix style numeric permissions.
|
void |
unix(java.lang.String unixNumericOrSymbolic) |
Sets Unix style permissions.
|
void |
user(Action<? super ConfigurableUserClassFilePermissions> configureAction) |
Modifies the permissions the owner of the file has for the file/directory.
|
toUnixNumeric
ConfigurableUserClassFilePermissions getUser()
The returned object is live, modifying it will change the user's permissions.
For further details on permissions see ConfigurableUserClassFilePermissions
.
getUser
in interface FilePermissions
void user(Action<? super ConfigurableUserClassFilePermissions> configureAction)
For further details on permissions see ConfigurableUserClassFilePermissions
.
Note that the provided configuration action only applies incremental modifications on top of whatever permission
the user has at the moment and that the default values permissions start out are different for files and directories
(see UserClassFilePermissions
).
ConfigurableUserClassFilePermissions getGroup()
The returned object is live, modifying it will change the user's permissions.
For further details on permissions see ConfigurableUserClassFilePermissions
.
getGroup
in interface FilePermissions
void group(Action<? super ConfigurableUserClassFilePermissions> configureAction)
For further details on permissions see ConfigurableUserClassFilePermissions
.
Note that the provided configuration action only applies incremental modifications on top of whatever permission
the user has at the moment and that the default values permissions start out are different for files and directories
(see UserClassFilePermissions
).
ConfigurableUserClassFilePermissions getOther()
The returned object is live, modifying it will change the user's permissions.
For further details on permissions see ConfigurableUserClassFilePermissions
.
getOther
in interface FilePermissions
void other(Action<? super ConfigurableUserClassFilePermissions> configureAction)
For further details on permissions see ConfigurableUserClassFilePermissions
.
Note that the provided configuration action only applies incremental modifications on top of whatever permission
the user has at the moment and that the default values permissions start out are different for files and directories
(see UserClassFilePermissions
).
void unix(java.lang.String unixNumericOrSymbolic)
The NUMERIC notation consist of 3 digits having values from 0 to 7. 1st digit represents the OWNER, 2nd represents the GROUP while the 3rd represents OTHER users.
Each of the digits is the sum of its component bits in the binary numeral system. Each of the 3 bits represents a permission. 1st bit is the READ bit, adds 4 to the digit (binary 100). 2nd bit is the WRITE bit, adds 2 to the digit (binary 010). 3rd bit is the EXECUTE bit, adds 1 to the digit (binary 001).
See the examples below.
NOTE: providing the 3 numeric digits can also be done in the octal literal form, so "0740" will be handled identically to "740".
The SYMBOLIC notation consists of 3 sets of 3 characters. The 1st set represents the OWNER, the 2nd set represents the GROUP, the 3rd set represents OTHER users.
Each of the tree characters represents the read, write and execute permissions:
r
if READING is permitted, -
if it is not; must be 1st in the setw
if WRITING is permitted, -
if it is not; must be 2nd in the setx
if EXECUTING is permitted, -
if it is not; must be 3rd in the setExamples:
Numeric | Symbolic | Meaning |
---|---|---|
000 | --------- | no permissions |
700 | rwx------ | read, write & execute only for owner |
770 | rwxrwx--- | read, write & execute for owner and group |
111 | --x--x--x | execute |
222 | -w--w--w- | write |
333 | -wx-wx-wx | write & execute |
444 | r--r--r-- | read |
555 | r-xr-xr-x | read & execute |
666 | rw-rw-rw- | read & write |
740 | rwxr----- | owner can read, write & execute; group can only read; others have no permissions |
An example usage of this method would be configuring a copy task and explicitly specifying the destination file permissions:
from(...) into(...) filePermissions { unix("r--r--r--") }
void unix(int unixNumeric)
unix(String)
for details.