push default methods on GroupManager to implementation on DefaultGroupManager
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/DefaultGroupManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/DefaultGroupManager.java
index b4f8d29..8ac7143 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/DefaultGroupManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/DefaultGroupManager.java
@@ -20,6 +20,7 @@
import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.Logger;
+import org.apache.wiki.api.core.Context;
import org.apache.wiki.api.core.Engine;
import org.apache.wiki.api.core.Session;
import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
@@ -321,6 +322,39 @@
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void validateGroup( final Context context, final Group group ) {
+ final InputValidator validator = new InputValidator( MESSAGES_KEY, context );
+
+ // Name cannot be null or one of the restricted names
+ try {
+ checkGroupName( context, group.getName() );
+ } catch( final WikiSecurityException e ) {
+ }
+
+ // Member names must be "safe" strings
+ final Principal[] members = group.members();
+ for( final Principal member : members ) {
+ validator.validateNotNull( member.getName(), "Full name", InputValidator.ID );
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void checkGroupName( final Context context, final String name ) throws WikiSecurityException {
+ // TODO: groups cannot have the same name as a user
+
+ // Name cannot be null
+ final InputValidator validator = new InputValidator( MESSAGES_KEY, context );
+ validator.validateNotNull( name, "Group name" );
+
+ // Name cannot be one of the restricted names either
+ if( ArrayUtils.contains( Group.RESTRICTED_GROUPNAMES, name ) ) {
+ throw new WikiSecurityException( "The group name '" + name + "' is illegal. Choose another." );
+ }
+ }
+
/**
* Extracts carriage-return separated members into a Set of String objects.
*
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
index f6986b3..3deea3a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
@@ -18,7 +18,6 @@
*/
package org.apache.wiki.auth.authorize;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.wiki.api.core.Context;
import org.apache.wiki.api.core.Session;
import org.apache.wiki.auth.Authorizer;
@@ -27,10 +26,8 @@
import org.apache.wiki.event.WikiEventListener;
import org.apache.wiki.event.WikiEventManager;
import org.apache.wiki.event.WikiSecurityEvent;
-import org.apache.wiki.ui.InputValidator;
import javax.servlet.http.HttpServletRequest;
-import java.security.Principal;
/**
@@ -185,22 +182,7 @@
* @param context the current wiki context
* @param group the supplied Group
*/
- default void validateGroup( final Context context, final Group group ) {
- final InputValidator validator = new InputValidator( MESSAGES_KEY, context );
-
- // Name cannot be null or one of the restricted names
- try {
- checkGroupName( context, group.getName() );
- } catch( final WikiSecurityException e ) {
- }
-
- // Member names must be "safe" strings
- final Principal[] members = group.members();
- for( final Principal member : members ) {
- validator.validateNotNull( member.getName(), "Full name", InputValidator.ID );
- }
- }
-
+ void validateGroup( final Context context, final Group group );
/**
* Checks if a String is blank or a restricted Group name, and if it is, appends an error to the Session's message list.
@@ -210,18 +192,7 @@
* @throws WikiSecurityException if <code>session</code> is <code>null</code> or the Group name is illegal
* @see Group#RESTRICTED_GROUPNAMES
*/
- default void checkGroupName( final Context context, final String name ) throws WikiSecurityException {
- // TODO: groups cannot have the same name as a user
-
- // Name cannot be null
- final InputValidator validator = new InputValidator( MESSAGES_KEY, context );
- validator.validateNotNull( name, "Group name" );
-
- // Name cannot be one of the restricted names either
- if( ArrayUtils.contains( Group.RESTRICTED_GROUPNAMES, name ) ) {
- throw new WikiSecurityException( "The group name '" + name + "' is illegal. Choose another." );
- }
- }
+ void checkGroupName( final Context context, final String name ) throws WikiSecurityException;
// events processing .......................................................