[xwiki-devs] Regarding inconsistent document rights issue
Hi all. I had implemented the copy of rights from the document space preferences to the individual document as the user created a new document. For example, the document space preferences have the following rights: document name: ABC.WebPreferences group: A_ADMIN rights: view, comment, edit And if the user XYZ (member of A_ADMIN group) who wants to create a new document name "Hello" in ABC space, the rights of A_ADMIN in ABC.WebPreferences should be copied over to "Hello" document. However, after creating the document, user XYZ was unable to view the newly created document despite it has the rights. I reconfirmed that user XYZ have the rights to view the document Hello as i login using Admin to verify. These changes are done in SaveAction.java file by appending the code as fellow: ....... if(tdoc.isNew()) { // copy all the rights the user is member of from the space.WebPreferences document tdoc.createNewObject("XWiki.XWikiRights", context); com.xpn.xwiki.objects.BaseObject bobject = tdoc.getObject("XWiki.XWikiRights", counter); // where counter will start from 0 and then ++++ bobject.setStringValue("allow", 1); bobject.setStringValue("groups", VALUE_FROM_Space.WebPreferences); bobject.setStringValue("levels", VALUE_FROM_Space.WebPreferences); } tdoc.setMetaDataDirty(true); xwiki.saveDocument(tdoc, tdoc.getComment(), tdoc.isMinorEdit(), context); XWikiLock lock = tdoc.getLock(context); if(lock != null) tdoc.removeLock(context); FYI: I am using Oracle 10gR1 as the backend database and xwiki rev 9145 Regards, Colin ______________________________________________________________________ Search, browse and book your hotels and flights through Yahoo! Travel. http://sg.travel.yahoo.com
participants (1)
-
Colin Tay