On Mar 3, 2008, at 9:57 PM, sdumitriu (SVN) wrote:
Author: sdumitriu
Date: 2008-03-03 21:57:43 +0100 (Mon, 03 Mar 2008)
New Revision: 8181
Modified:
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
XWiki.java
Log:
XWIKI-2170: Allow inactive users to see specific pages
What's an inactive user?
I think the code below would benefit from some comment and from a
separate method, like boolean checkAccessForInactiveUsers()
Do we have tests to prove this works? :) Since this seems to be a new
feature, I think we really need some tests.
Thanks
-Vincent
Done.
Patch submitted by David Ward, applied with minor changes.
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/
xwiki/XWiki.java
===================================================================
--- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
XWiki.java 2008-03-03 20:01:33 UTC (rev 8180)
+++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
XWiki.java 2008-03-03 20:57:43 UTC (rev 8181)
@@ -4209,13 +4209,26 @@
null,
args);
} else if (checkActive(context) == 0) {
- Object[] args = {context.getUser()};
- setPhonyDocument(docName, context, vcontext);
- throw new
XWikiException(XWikiException.MODULE_XWIKI_USER,
- XWikiException.ERROR_XWIKI_USER_INACTIVE,
- "User {0} account is inactive",
- null,
- args);
+ boolean allow = false;
+ String allowed =
Param("xwiki.inactiveuser.allowedpages", "");
+ if (context.getAction().equals("view") && !
allowed.equals("")) {
+ String[] allowedList = StringUtils.split(allowed,
" ,");
+ for (int i=0; i < allowedList.length; i++) {
+ if (allowedList[i].equals(doc.getFullName())) {
+ allow = true;
+ break;
+ }
+ }
+ }
+ if (!allow) {
+ Object[] args = {context.getUser()};
+ setPhonyDocument(docName, context, vcontext);
+ throw new
XWikiException(XWikiException.MODULE_XWIKI_USER,
+ XWikiException.ERROR_XWIKI_USER_INACTIVE,
+ "User {0} account is inactive",
+ null,
+ args);
+ }
}
context.put("doc", doc);
_______________________________________________
notifications mailing list
notifications(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications