Package org.apache.ignite.plugin.security

## Class SecurityPermissionSetBuilder

- java.lang.Object
- - org.apache.ignite.plugin.security.SecurityPermissionSetBuilder

-     public class SecurityPermissionSetBuilder
      extends Object

  Provides a convenient way to create a permission set.

  Here is example:

            SecurityPermissionSet permsSet = new SecurityPermissionSetBuilder()
                .appendCachePermissions("cache1", CACHE_PUT, CACHE_REMOVE)
                .appendCachePermissions("cache2", CACHE_READ)
                .appendTaskPermissions("task1", TASK_CANCEL)
                .appendTaskPermissions("task2", TASK_EXECUTE)
                .appendSystemPermissions(ADMIN_VIEW, EVENTS_ENABLE)
                .build();

  The builder also does additional validation. For example, if you try to append `EVENTS_ENABLE` permission for a cache, exception will be thrown:

            SecurityPermissionSet permsSet = new SecurityPermissionSetBuilder()
                .appendCachePermissions("cache1", EVENTS_ENABLE)
                .build();

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static SecurityPermissionSet` | `ALL_PERMISSIONS` |
    `static SecurityPermissionSet` | `NO_PERMISSIONS` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SecurityPermissionSetBuilder()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SecurityPermissionSetBuilder` | `appendCachePermissions​(String name, SecurityPermission... perms)` | Append permission set form `cache` with `name`.
    `SecurityPermissionSetBuilder` | `appendServicePermissions​(String name, SecurityPermission... perms)` | Append permission set form `service` with `name`.
    `SecurityPermissionSetBuilder` | `appendSystemPermissions​(SecurityPermission... perms)` | Append system permission set.
    `SecurityPermissionSetBuilder` | `appendTaskPermissions​(String name, SecurityPermission... perms)` | Append permission set form `task` with `name`.
    `SecurityPermissionSet` | `build()` | Builds the `SecurityPermissionSet`.
    `static SecurityPermissionSetBuilder` | `create()` | Static factory method for create new permission builder.
    `SecurityPermissionSetBuilder` | `defaultAllowAll​(boolean dfltAllowAll)` | Append default all flag.
    `static SecurityPermissionSet` | `systemPermissions​(SecurityPermission... perms)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALL_PERMISSIONS

          public static final SecurityPermissionSet ALL_PERMISSIONS

    - #### NO_PERMISSIONS

          public static final SecurityPermissionSet NO_PERMISSIONS

  - ### Constructor Detail

    - #### SecurityPermissionSetBuilder

          public SecurityPermissionSetBuilder()

  - ### Method Detail

    - #### create

          public static SecurityPermissionSetBuilder create()

      Static factory method for create new permission builder.
      Returns:
        SecurityPermissionSetBuilder

    - #### defaultAllowAll

          public SecurityPermissionSetBuilder defaultAllowAll​(boolean dfltAllowAll)

      Append default all flag.
      Parameters:
        `dfltAllowAll` - Default allow all.
      Returns:
        SecurityPermissionSetBuilder refer to same permission builder.

    - #### appendTaskPermissions

          public SecurityPermissionSetBuilder appendTaskPermissions​(String name,
                                                                    SecurityPermission... perms)

      Append permission set form `task` with `name`.
      Parameters:
        `name` - String for map some task to permission set.
        `perms` - Permissions.
      Returns:
        SecurityPermissionSetBuilder refer to same permission builder.

    - #### appendServicePermissions

          public SecurityPermissionSetBuilder appendServicePermissions​(String name,
                                                                       SecurityPermission... perms)

      Append permission set form `service` with `name`.
      Parameters:
        `name` - String for map some service to permission set.
        `perms` - Permissions.
      Returns:
        SecurityPermissionSetBuilder refer to same permission builder.

    - #### appendCachePermissions

          public SecurityPermissionSetBuilder appendCachePermissions​(String name,
                                                                     SecurityPermission... perms)

      Append permission set form `cache` with `name`.
      Parameters:
        `name` - String for map some cache to permission set.
        `perms` - Permissions.
      Returns:
        `SecurityPermissionSetBuilder` refer to same permission builder.

    - #### appendSystemPermissions

          public SecurityPermissionSetBuilder appendSystemPermissions​(SecurityPermission... perms)

      Append system permission set.
      Parameters:
        `perms` - Permission.
      Returns:
        `SecurityPermissionSetBuilder` refer to same permission builder.

    - #### build

          public SecurityPermissionSet build()

      Builds the `SecurityPermissionSet`.
      Returns:
        `SecurityPermissionSet` instance.

    - #### systemPermissions

          public static SecurityPermissionSet systemPermissions​(SecurityPermission... perms)

      Parameters:
        `perms` - System permissions.
      Returns:
        `SecurityPermissionSet` instance with specified permissions added.