|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.BasicStoreListener com.jalios.jcms.AudienceRights
public class AudienceRights
This class manages a Member's read right on publication using their categories.
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").
Field Summary | |
---|---|
protected List<BitSet> |
categoriesAxesBSList
|
protected List<Category> |
categoriesAxesList
|
protected int |
categoryNumber
|
protected Object |
categoryNumberLock
|
protected HashMap<Category,BitSet> |
categoryToBSMap
|
protected Channel |
channel
|
protected boolean |
isEnabled
|
protected HashMap<Member,BitSet> |
memberToBSMap
|
protected HashMap<Publication,BitSet> |
publicationToBSMap
|
static String |
REVISION
|
Method Summary | |
---|---|
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 List<BitSet> |
computeCategoriesAxesBSList()
|
protected BitSet |
computeMemberBS(Member member)
|
protected List<BitSet> |
getCategoriesAxesBSList()
Retrieve the List of BitSet (one for each category axe). |
List<Category> |
getCategoriesAxesList()
Retrieve the list containing all the root categories of the audience rights axes. |
protected BitSet |
getCategoryBS(Category category)
Retrieve the BitSet associated with the given Category. |
protected BitSet |
getCategorySetBS(Set<Category> catSet)
Creates and returns a BitSet from a Set of Category, using their indivual BitSet. |
static AudienceRights |
getInstance()
|
protected BitSet |
getMemberBS(Member member)
Retrieve the BitSet associated with the given Member. |
protected 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. |
Methods inherited from class com.jalios.jcms.BasicStoreListener |
---|
handlePrepareUpdate, init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
protected Channel channel
protected boolean isEnabled
protected List<Category> categoriesAxesList
protected List<BitSet> categoriesAxesBSList
protected int categoryNumber
protected Object categoryNumberLock
protected HashMap<Category,BitSet> categoryToBSMap
protected HashMap<Publication,BitSet> publicationToBSMap
protected HashMap<Member,BitSet> memberToBSMap
Method Detail |
---|
public void reloadProperties()
public boolean isEnabled()
public List<Category> getCategoriesAxesList()
public static AudienceRights getInstance()
public boolean checkRights(Publication pub, Member member)
pub
- the publicationmember
- the member
protected 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 BitSet getMemberBS(Member member)
member
- the Member of which to retrieve the BitSet.
protected BitSet computeMemberBS(Member member)
protected void clearMemberBS(Member member)
member
- the Member of which to clear the BitSet.protected void clearMemberBSListMap()
protected BitSet getCategoryBS(Category category)
category
- the Category of which to retrieve the BitSet.
protected List<BitSet> getCategoriesAxesBSList()
protected List<BitSet> computeCategoriesAxesBSList()
protected void clearCategoriesAxesBSList()
protected BitSet getCategorySetBS(Set<Category> catSet)
catSet
- a Set of Category to use to create a new BitSet
public 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 occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |