Class ACLImpl
- java.lang.Object
-
- org.jboss.security.acl.ACLImpl
-
- All Implemented Interfaces:
Serializable
,ACL
@Entity public class ACLImpl extends Object implements ACL, Serializable
Simple ACL implementation that keeps the entries in a Map whose keys are the identities of the entries, to provide fast access.
- Author:
- Stefan Guilhen
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ACLImpl(String resourceString, Collection<ACLEntry> entries)
ACLImpl(Resource resource)
Builds an instance ofACLImpl
for the specified resource.ACLImpl(Resource resource, Collection<ACLEntry> entries)
Builds an instance ofACLImpl
for the specified resource, and initialize it with the specified entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addEntry(ACLEntry entry)
Adds an entry to this ACL.long
getACLId()
Obtains the persistent id of thisACLImpl
.Collection<? extends ACLEntry>
getEntries()
Obtains the collection of allACLEntries
in this ACL.ACLEntry
getEntry(String identityOrRole)
Obtains the entry that corresponds to the specified identity or role name.ACLEntry
getEntry(Identity identity)
Obtains the entry that corresponds to the specified identity.Resource
getResource()
Obtains a reference to the resource being protected by this ACL.String
getResourceAsString()
Obtains the stringfied representation of the resource associated with thisACL
.boolean
isGranted(ACLPermission permission, Identity identity)
Verify if the given permission is assigned to the specifiedIdentity
.boolean
removeEntry(ACLEntry entry)
Removes an entry from this ACL.void
setResource(Resource resource)
Sets the resource associated with thisACL
.
-
-
-
Constructor Detail
-
ACLImpl
public ACLImpl(Resource resource)
Builds an instance of
ACLImpl
for the specified resource.- Parameters:
resource
- a reference to theResource
associated with the ACL being constructed.
-
ACLImpl
public ACLImpl(Resource resource, Collection<ACLEntry> entries)
Builds an instance of
ACLImpl
for the specified resource, and initialize it with the specified entries.- Parameters:
resource
- a reference to theResource
associated with the ACL being constructed.entries
- aCollection
containing the ACL's initial entries.
-
ACLImpl
public ACLImpl(String resourceString, Collection<ACLEntry> entries)
-
-
Method Detail
-
getACLId
public long getACLId()
Obtains the persistent id of this
ACLImpl
.- Returns:
- a
long
representing the persistent id this ACL.
-
addEntry
public boolean addEntry(ACLEntry entry)
Description copied from interface:ACL
Adds an entry to this ACL. If the ACL already has an
ACLEntry
associated to the new entry's identity, then the new entry will not be added.
-
removeEntry
public boolean removeEntry(ACLEntry entry)
Description copied from interface:ACL
Removes an entry from this ACL.
- Specified by:
removeEntry
in interfaceACL
- Parameters:
entry
- theACLEntry
to be removed.- Returns:
true
if the entry is removed;false
if the entry can't be found in the ACL.
-
getEntries
public Collection<? extends ACLEntry> getEntries()
Description copied from interface:ACL
Obtains the collection of all
ACLEntries
in this ACL.- Specified by:
getEntries
in interfaceACL
- Returns:
- a
Collection
containing all entries in this ACL.
-
getEntry
public ACLEntry getEntry(Identity identity)
Description copied from interface:ACL
Obtains the entry that corresponds to the specified identity. Calling this method is the same as doing
getEntry(identity.getName())
.
-
getEntry
public ACLEntry getEntry(String identityOrRole)
Description copied from interface:ACL
Obtains the entry that corresponds to the specified identity or role name.
-
isGranted
public boolean isGranted(ACLPermission permission, Identity identity)
Description copied from interface:ACL
Verify if the given permission is assigned to the specified
Identity
.
-
getResourceAsString
public String getResourceAsString()
Obtains the stringfied representation of the resource associated with this
ACL
.- Returns:
- a
String
representation of the resource.
-
getResource
public Resource getResource()
Description copied from interface:ACL
Obtains a reference to the resource being protected by this ACL.
- Specified by:
getResource
in interfaceACL
- Returns:
- a reference to the
Resource
.
-
setResource
public void setResource(Resource resource)
Sets the resource associated with this
ACL
.- Parameters:
resource
- a reference to theResource
associated with thisACL
.
-
-