Interface AccessController

  • All Known Implementing Classes:
    AccessController.Impl

    public interface AccessController
    The access controller.
    Author:
    Christian Bremer
    • Method Detail

      • from

        static AccessController from​(@Nullable
                                     org.bremersee.common.model.AccessControlList acl)
        Creates an access controller from the given access control list.
        Parameters:
        acl - the access control list
        Returns:
        the access controller
      • from

        static AccessController from​(@Nullable
                                     Acl acl)
        Creates an access controller from the given access control list.
        Parameters:
        acl - the access control list
        Returns:
        the access controller
      • hasPermission

        boolean hasPermission​(@Nullable
                              String user,
                              @Nullable
                              Collection<String> roles,
                              @Nullable
                              Collection<String> groups,
                              @Nullable
                              String permission)
        Determines whether the given user with the given roles and groups has the specified permission.
        Parameters:
        user - the user
        roles - the roles
        groups - the groups
        permission - the permission
        Returns:
        true if the user has the permission, otherwise false
      • hasAnyPermission

        default boolean hasAnyPermission​(@Nullable
                                         String user,
                                         @Nullable
                                         Collection<String> roles,
                                         @Nullable
                                         Collection<String> groups,
                                         @Nullable
                                         String... permissions)
        Determines whether the given user with the given roles and groups has at least one of the specified permissions.
        Parameters:
        user - the user
        roles - the roles
        groups - the groups
        permissions - the permissions
        Returns:
        true if the user has at least one permission, otherwise false
      • hasAnyPermission

        default boolean hasAnyPermission​(@Nullable
                                         String user,
                                         @Nullable
                                         Collection<String> roles,
                                         @Nullable
                                         Collection<String> groups,
                                         @Nullable
                                         Collection<String> permissions)
        Determines whether the given user with the given roles and groups has at least one of the specified permissions.
        Parameters:
        user - the user
        roles - the roles
        groups - the groups
        permissions - the permissions
        Returns:
        true if the user has at least one permission, otherwise false
      • hasAllPermissions

        default boolean hasAllPermissions​(String user,
                                          Collection<String> roles,
                                          Collection<String> groups,
                                          String... permissions)
        Determines whether the given user with the given roles and groups has all specified permissions.
        Parameters:
        user - the user
        roles - the roles
        groups - the groups
        permissions - the permissions
        Returns:
        true if the user has all permissions, otherwise false
      • hasAllPermissions

        default boolean hasAllPermissions​(String user,
                                          Collection<String> roles,
                                          Collection<String> groups,
                                          Collection<String> permissions)
        Determines whether the given user with the given roles and groups has all specified permissions.
        Parameters:
        user - the user
        roles - the roles
        groups - the groups
        permissions - the permissions
        Returns:
        true if the user has all permissions, otherwise false