public final class PermissionsEntity extends AbstractEntity implements Permissions
Modifier and Type | Class and Description |
---|---|
static class |
PermissionsEntity.Builder
Builder.
|
Permissions.Action
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT_NAME
Permissions element name.
|
static String |
ENTITY_PREFIX
Permissions entity prefix.
|
UUID_COMPARATOR
Modifier and Type | Method and Description |
---|---|
void |
adopt(PermissionsEntity child)
Adopts a child.
|
void |
allow(String role,
Permissions.Action action)
Allows an action for a role.
|
boolean |
check(Permissions.Action action,
Optional<Identity> identity)
Checks if an action is allowed by at least one role.
|
PermissionsEntity |
copy()
Creates a copy of this entity.
|
void |
deny(String role,
Permissions.Action action)
Denies an action for a role.
|
boolean |
equals(Object other)
|
String |
getElementName()
Gets the entity element name.
|
Map<String,Set<Permissions.Action>> |
getPermissions()
Gets the permissions.
|
String |
getPrefix()
Gets the class prefix.
|
String |
getReferenceName()
Gets the entity reference name.
|
int |
hashCode() |
static PermissionsEntity.Builder |
newBuilder()
Returns a new builder.
|
compareTo, getAttributes, getName, getNameInUpperCase, getThisLogger, getUUID, setName, setUUID, toString
public static final String ELEMENT_NAME
public static final String ENTITY_PREFIX
@Nonnull @CheckReturnValue public static PermissionsEntity.Builder newBuilder()
public void adopt(@Nonnull PermissionsEntity child)
child
- The child.public void allow(@Nonnull String role, @Nonnull Permissions.Action action)
role
- The role.action
- The action.public boolean check(Permissions.Action action, Optional<Identity> identity)
check
in interface Permissions
action
- The action.identity
- The optional identity.public PermissionsEntity copy()
public void deny(@Nonnull String role, @Nonnull Permissions.Action action)
role
- The role.action
- The action.public boolean equals(Object other)
For two Entity
to be equal, they must at least be instances of
the same class, have the same UUID
and name.
equals
in class AbstractEntity
public String getElementName()
The entity element is used to in the generation of the entity URI.
getElementName
in interface Entity
@Nonnull @CheckReturnValue public Map<String,Set<Permissions.Action>> getPermissions()
public String getPrefix()
Each concrete entity subclass has its own prefix which will be the same for all its instances. This prefix is used to avoid name collision between different classes in a common registry.
public String getReferenceName()
getReferenceName
in interface Entity
public int hashCode()
hashCode
in class AbstractEntity
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.