Package org.bremersee.security.access
Interface AccessController
-
- All Known Implementing Classes:
AccessController.Impl
public interface AccessController
The access controller.- Author:
- Christian Bremer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AccessController.Impl
The default access controller implementation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static AccessController
from(org.bremersee.common.model.AccessControlList acl)
Creates an access controller from the given access control list.static AccessController
from(Acl acl)
Creates an access controller from the given access control list.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.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.default boolean
hasAnyPermission(String user, Collection<String> roles, Collection<String> groups, String... permissions)
Determines whether the given user with the given roles and groups has at least one of the specified permissions.default boolean
hasAnyPermission(String user, Collection<String> roles, Collection<String> groups, Collection<String> permissions)
Determines whether the given user with the given roles and groups has at least one of the specified permissions.boolean
hasPermission(String user, Collection<String> roles, Collection<String> groups, String permission)
Determines whether the given user with the given roles and groups has the specified permission.
-
-
-
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 userroles
- the rolesgroups
- the groupspermission
- the permission- Returns:
true
if the user has the permission, otherwisefalse
-
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 userroles
- the rolesgroups
- the groupspermissions
- the permissions- Returns:
true
if the user has at least one permission, otherwisefalse
-
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 userroles
- the rolesgroups
- the groupspermissions
- the permissions- Returns:
true
if the user has at least one permission, otherwisefalse
-
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 userroles
- the rolesgroups
- the groupspermissions
- the permissions- Returns:
true
if the user has all permissions, otherwisefalse
-
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 userroles
- the rolesgroups
- the groupspermissions
- the permissions- Returns:
true
if the user has all permissions, otherwisefalse
-
-