JIVE Note 7 - JIVE's hard injury (1) jive2.x permissions granules are too thick, just subdivision to Forum, so API cannot complete similar encryption / need to reply to see such functions. Of course, you can implement the JSP through the attribute operation, but this is not our goal. (2) JIVE2.X Permissions Rules: The superiors cover the lower level. Example: There is a category 1, Everyone Ot, there are millum 1, 2, 3, ..... 100. Now, I want to let Forum2 only let registered users, then you can't do it! Unless: delete the EVERYONE READ permissions of Category1, add the Everyone Read permission to Forum1, 3, 4, 5 .... 100, and then set the registed user read permission to the forum2. (3) If the number of category / forums becomes hundred thousand, the JIVE efficiency will be greatly reduced. JIVE2.X did not take into account this situation during design, and the permissions were only implemented to Forum. On the code processing, look at IteratorProxy.Javapublic IteratorProxy (int Type, Iterator Iterator, Authorization Authorization,
Forum permissions
{
This.iterator = Iterator;
THIS.AUTHORIZATION = Authorization;
THIS.PERMISSIONS = permissions;
// load the appropriate proxy factory depending on the Type of Object
// That We're Iterating THROUGH. Each Proxy Factory Is Responsible
// for checking That the user has permission to view the object, and
// the Wrapping it with an appprike proxy.
Switch (Type) {
// category
Case Jiveglobals.forum_category:
// CREATE a Class That Wraps forums with proxies.
ProxyFactory = new proxyFactory () {
Public Object CreateProxy (Object Obj, Authorization Auth,
Forum Perms
{
Forumcategory category = (forumcategory) OBJ;
// Create a new permissions object with the combination
// of the permissions of this Object and temppermissions.
INT PARENTPERMS = Perms.Toint ();
// never inherit the show category permission.
ForumPermissions newperms = new forumpermissions
ForumPERMISSIONS.SETBIT (PARENTPERMS,
ForumPERMISSIONS.SHOW_CATEGORY, FALSE);
ForumPERMISSION CATPERMS = Category.getPermissions (Auth);
Newperms = new forumpermissions; // return the object if the user has permission.
IF (newperms.get (forumpermissions.read_forum) ||
Newperms.get (forumpermissions.show_category) ||
Newperms.get (forumpermissions.moderate_messages) ||
Newperms.get (forumpermissions.moderate_threads) ||
Newperms.get (forumpermissions.forum_admin) ||
Newperms.get (forumpermissions.category_admin) ||
Newperms.get (forumpermissions.system_admin))
{
Return New ForumCategoryProxy (Category, Auth, Newperms);
}
// Otherwise return null.
Else {
Return NULL;
}
}
}
Break;
Analysis: Suppose there is Category 1, 2, 3, 4, 5, where category2 only allows registered users to access. It is now anonymous access. The Iterator that is incorporated in the constructor contains all Category objects, which determines the permissions in the createProxy () of the anonymous class. If you are copying Category 2, there is no doubt that NULL will be returned (this, Category2 is filtered). CreateProxy () of anonymous classes will be called by IteeratorProxy's getNextElement (), the code is as follows: public object getnextelement () {
While (item.hasnext ()) {
Object element = proxyFactory.createProxy (item.next (),
Authorization, permissions;
IF (Element! = null) {
Return Element;
}
}
Return NULL;
}
The While () here will skip the filter-filtered object (actually a null object), returns the Category object visible in the current Auth. Observe the FORUMCATEGORY interface, only categories () methods, without categories (resultfilter), indicating that no paging processing is made. If we add paging processing, pay attention to the filtering of IteratorProxy, and the actual category number and the inconsistency of page size are caused. For example, there are 30 category, I have a categories (resultfilter) to return 15, after IteratorProxy, it is filtered out of one such that there is only 14 category, which will make JSP confused, think Resultfilter.SetPageSize Not right. Attachment: It was a long note. It took more than an hour. When I wanted to submit a form, IE collapsed! Want to cry without tears! I found that the culprit was superbar.dll, I don't know what garbage, and I have a comprehensive clear. . . .