public class AudienceRights extends BasicStoreListener
How does it work? :
You can use N audience axes to check rights, 1 axe is 1 category branch.
A member is allowed to read a publication only if, for each audience axes,
the read categories of the Member Member.getReadCategorySet()
are under the categories of the Publication Publication.getCategorySet()
Let's say we have those categories:
root - Keywords - Location * - Europe - France - Ile de France - Gers - England - Asia - Japan - China - Line of work * - All jobs - Marketing - Engineering* categories used as audience axes.
Two members with those read categories checked from the axes:
M1: - Ile de France - Engineering M2: - Europe - Marketing
Some publications with those categories: P1: - France - All jobs P2: - England - Engineering
M1 is allowed to read P1 (category "Ile de France" is in "France" AND "Engineering" is in "All jobs"). But M1 is NOT allowed to read P2 (category "Ile de France" is NOT in "England", even though category "Engineering" matches).
M2 is allowed to read P1 (category "Europe" is an ancestor of "France" AND "Marketing" is in "All jobs"). M2 is NOT allowed to read P2 (category "Europe" is an ancestor of "England", but category "Engineering" does not matches "Marketing").
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.util.BitSet> |
categoriesAxesBSList |
protected java.util.List<Category> |
categoriesAxesList |
protected int |
categoryNumber |
protected java.lang.Object |
categoryNumberLock |
protected java.util.HashMap<Category,java.util.BitSet> |
categoryToBSMap |
protected Channel |
channel |
protected boolean |
isEnabled |
protected java.util.HashMap<Member,java.util.BitSet> |
memberToBSMap |
protected java.util.HashMap<Publication,java.util.BitSet> |
publicationToBSMap |
static java.lang.String |
REVISION |
Modifier and Type | Method and Description |
---|---|
boolean |
checkRights(Publication pub,
Member member)
Check if the publication can be read by the given member using AudienceRights.
|
protected void |
clearCategoriesAxesBSList()
Clear the list of BitSet (one for each category axe).
|
protected void |
clearMemberBS(Member member)
Clear the BitSet associated with the given Member.
|
protected void |
clearMemberBSListMap()
Clear the map which associate member to their BitSet.
|
protected void |
clearPublicationBS(Publication pub)
Clear the BitSet associated with the given Publication.
|
protected java.util.List<java.util.BitSet> |
computeCategoriesAxesBSList() |
protected java.util.BitSet |
computeMemberBS(Member member) |
protected java.util.List<java.util.BitSet> |
getCategoriesAxesBSList()
Retrieve the List of BitSet (one for each category axe).
|
java.util.List<Category> |
getCategoriesAxesList()
Retrieve the list containing all the root categories of the audience rights axes.
|
protected java.util.BitSet |
getCategoryBS(Category category)
Retrieve the BitSet associated with the given Category.
|
protected java.util.BitSet |
getCategorySetBS(java.util.Set<Category> catSet)
Creates and returns a BitSet from a Set of Category, using
their indivual BitSet.
|
static AudienceRights |
getInstance() |
protected java.util.BitSet |
getMemberBS(Member member)
Retrieve the BitSet associated with the given Member.
|
protected java.util.BitSet |
getPublicationBS(Publication pub)
Retrieve the BitSet associated with the given publication.
|
void |
handleCommitUpdate(Storable storable,
Storable oldStorable,
boolean firstime)
This method gets called when after a storable has been updated.
|
void |
handleCreate(Storable storable,
boolean firstime)
This method gets called when a storable is created.
|
void |
handleDelete(Storable storable,
boolean firstime)
This method gets called when a storable is deleted.
|
boolean |
isEnabled() |
void |
reloadProperties() |
protected void |
updateStorableBS(Storable storable)
Reset the internal BitSet(s) depending on the modification of the given Storable.
|
handlePrepareUpdate, init
public static final java.lang.String REVISION
protected Channel channel
protected boolean isEnabled
protected java.util.List<Category> categoriesAxesList
protected java.util.List<java.util.BitSet> categoriesAxesBSList
protected int categoryNumber
protected java.lang.Object categoryNumberLock
protected java.util.HashMap<Category,java.util.BitSet> categoryToBSMap
protected java.util.HashMap<Publication,java.util.BitSet> publicationToBSMap
protected java.util.HashMap<Member,java.util.BitSet> memberToBSMap
public void reloadProperties()
public boolean isEnabled()
public java.util.List<Category> getCategoriesAxesList()
public static AudienceRights getInstance()
public boolean checkRights(Publication pub, Member member)
pub
- the publicationmember
- the memberprotected java.util.BitSet getPublicationBS(Publication pub)
pub
- the publication of which to retrieve the BitSet.protected void clearPublicationBS(Publication pub)
pub
- the publication of which to remove the BitSet.protected java.util.BitSet getMemberBS(Member member)
member
- the Member of which to retrieve the BitSet.protected java.util.BitSet computeMemberBS(Member member)
protected void clearMemberBS(Member member)
member
- the Member of which to clear the BitSet.protected void clearMemberBSListMap()
protected java.util.BitSet getCategoryBS(Category category)
category
- the Category of which to retrieve the BitSet.protected java.util.List<java.util.BitSet> getCategoriesAxesBSList()
protected java.util.List<java.util.BitSet> computeCategoriesAxesBSList()
protected void clearCategoriesAxesBSList()
protected java.util.BitSet getCategorySetBS(java.util.Set<Category> catSet)
catSet
- a Set of Category to use to create a new BitSetpublic void handleCreate(Storable storable, boolean firstime)
StoreListener
handleCreate
in interface StoreListener
handleCreate
in class BasicStoreListener
storable
- the storablefirstime
- true if it is the first time this operation is processedStoreListener.handleCreate(Storable, boolean)
public void handleCommitUpdate(Storable storable, Storable oldStorable, boolean firstime)
StoreListener
handleCommitUpdate
in interface StoreListener
handleCommitUpdate
in class BasicStoreListener
storable
- the storable, this instance is the object that was created
at first and that will be stored in jcms until deletion of the storable
with this ID.
You should always manipulate this object if you maintain any index.oldStorable
- the previous version of the storable, it is a clone, do not use
in any index, it should only be used to access old values.firstime
- true if it is the first time this operation is processedStoreListener.handleCommitUpdate(Storable, Storable, boolean)
public void handleDelete(Storable storable, boolean firstime)
StoreListener
handleDelete
in interface StoreListener
handleDelete
in class BasicStoreListener
storable
- the storablefirstime
- true if it is the first time this operation is processedStoreListener.handleDelete(Storable, boolean)
protected void updateStorableBS(Storable storable)
storable
- the Storable on which a modification occuredCopyright © 2001-2010 Jalios SA. All Rights Reserved.