# Interface ConfigurableFilePermissions

All Superinterfaces:
  `FilePermissions`

public interface ConfigurableFilePermissions extends FilePermissions
Provides the means of specifying file and directory access permissions for all classes of system users.

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
    }

Since:
  8.3

- ## Method Summary

  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(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.

  ### Methods inherited from interface FilePermissions

  `toUnixNumeric`

- ## Method Details

  - ### getUser

    ConfigurableUserClassFilePermissions getUser()
    Returns the permissions the owner of the file has for the file/directory.

    The returned object is live, modifying it will change the user's permissions.

    For further details on permissions see `ConfigurableUserClassFilePermissions`.

    Specified by:
      `getUser` in interface `FilePermissions`

  - ### user

    void user(Action<? super ConfigurableUserClassFilePermissions> configureAction)
    Modifies the permissions the owner of the file has for the file/directory.

    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`).

  - ### getGroup

    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.

    The returned object is live, modifying it will change the user's permissions.

    For further details on permissions see `ConfigurableUserClassFilePermissions`.

    Specified by:
      `getGroup` in interface `FilePermissions`

  - ### group

    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.

    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`).

  - ### getOther

    ConfigurableUserClassFilePermissions getOther()
    Returns the permissions all other users (non-owner, non-group) have for the file/directory.

    The returned object is live, modifying it will change the user's permissions.

    For further details on permissions see `ConfigurableUserClassFilePermissions`.

    Specified by:
      `getOther` in interface `FilePermissions`

  - ### other

    void other(Action<? super ConfigurableUserClassFilePermissions> configureAction)
    Modifies the permissions all other users (non-owner, non-group) have for the file/directory.

    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`).

  - ### unix

    void unix(String unixNumericOrSymbolic)
    Sets Unix style permissions. Accept values in two styles of notation:
    - NUMERIC notation: uses 3 octal (base-8) digits representing permissions for the 3 categories of users; for example "755"
    - SYMBOLIC notation: uses 3 sets of 3 characters, each set representing the permissions for one of the user categories; for example "rwxr-xr-x"

    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 set
    - `w` if WRITING is permitted, `-` if it is not; must be 2nd in the set
    - `x` if EXECUTING is permitted, `-` if it is not; must be 3rd in the set

    Examples of Unix style permissions
    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--") }

  - ### unix

    void unix(int unixNumeric)
    Sets Unix style numeric permissions. See `unix(String)` for details.

    As described there, the value is expected to come from the range of 3 digit octal numbers, i.e. from 0 (included) to 512 (excluded).

    When represented in octal form, the numbers have the same meaning as their string counterparts (see `unix(String)`), so the following statements are all equivalent:

          unix("0740")         // octal number as string
          unix("740")          // octal number as string (no prefix)
          unix(0740)           // octal int literal
          unix(482)            // decimal int literal
          unix("rwxr-----")    // non-numeric string