You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2015/05/29 02:19:43 UTC
[2/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/AuditAuthzListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/AuditAuthzListModel.java b/src/main/java/org/apache/directory/fortress/web/model/AuditAuthzListModel.java
new file mode 100644
index 0000000..bd73b66
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/AuditAuthzListModel.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License" ); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.AuditMgr;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.AuthZ;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.UserAudit;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AuditAuthzListModel extends Model<SerializableList<AuthZ>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private AuditMgr auditMgr;
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger LOG = Logger.getLogger(AuditAuthzListModel.class.getName());
+ private transient UserAudit userAudit;
+ private transient SerializableList<AuthZ> authZs = null;
+
+ /**
+ * Default constructor
+ */
+ public AuditAuthzListModel( Session session )
+ {
+ Injector.get().inject( this );
+ auditMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param userAudit
+ */
+ public AuditAuthzListModel( UserAudit userAudit, Session session )
+ {
+ Injector.get().inject( this );
+ this.userAudit = userAudit;
+ auditMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Role> roles data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<AuthZ> getObject()
+ {
+ if (authZs != null)
+ {
+ LOG.debug( ".getObject count: " + authZs.size() );
+ return authZs;
+ }
+
+ // if caller did not set userId return an empty list:
+ if (userAudit == null ||
+ ( !VUtil.isNotNullOrEmpty( userAudit.getUserId() ) &&
+ !VUtil.isNotNullOrEmpty( userAudit.getObjName() ) &&
+ !VUtil.isNotNullOrEmpty( userAudit.getOpName() ) &&
+ //!VUtil.isNotNullOrEmpty( userAudit.getDn() ) &&
+ userAudit.getBeginDate() == null &&
+ userAudit.getEndDate() == null
+ )
+ ||
+ ( !VUtil.isNotNullOrEmpty( userAudit.getUserId() ) &&
+ VUtil.isNotNullOrEmpty( userAudit.getObjName() ) &&
+ !VUtil.isNotNullOrEmpty( userAudit.getOpName() ) &&
+ userAudit.getBeginDate() == null &&
+ userAudit.getEndDate() == null
+ )
+ )
+
+ {
+ LOG.debug( ".getObject null" );
+ authZs = new SerializableList<AuthZ>( new ArrayList<AuthZ>() );
+ }
+ else
+ {
+ // get the list of matching authorization records from fortress:
+ //log.debug( ".getObject authZ id: " + userAudit != null ? userAudit.getUserId() : "null" );
+ if ( VUtil.isNotNullOrEmpty( userAudit.getObjName()) && VUtil.isNotNullOrEmpty( userAudit.getOpName()) && !VUtil.isNotNullOrEmpty( userAudit.getDn() ) )
+ {
+ Permission permission = getPermission( userAudit );
+
+ if ( permission == null)
+ {
+ String warning = "Matching permission not found for object: " + userAudit.getObjName() + " operation: " + userAudit.getOpName();
+ LOG.warn( warning );
+ throw new RuntimeException( warning );
+ }
+
+ userAudit.setDn( permission.getDn() );
+ }
+
+ authZs = new SerializableList<AuthZ>( getList( userAudit ) );
+ userAudit.setDn( "" );
+ }
+
+ return authZs;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<AuthZ> object )
+ {
+ LOG.debug( ".setObject count: " + object.size() );
+ authZs = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ authZs = null;
+ userAudit = null;
+ }
+
+
+ private List<AuthZ> getList( UserAudit userAudit )
+ {
+ List<AuthZ> authZList = null;
+
+ try
+ {
+ authZList = auditMgr.getUserAuthZs( userAudit );
+ }
+ catch (org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return authZList;
+ }
+
+
+ private Permission getPermission( UserAudit userAudit )
+ {
+ Permission permission = null;
+
+ try
+ {
+ permission = reviewMgr.readPermission( new Permission ( userAudit.getObjName(), userAudit.getOpName(), userAudit.isAdmin()) );
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getPermission caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return permission;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/AuditBindListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/AuditBindListModel.java b/src/main/java/org/apache/directory/fortress/web/model/AuditBindListModel.java
new file mode 100644
index 0000000..8f42b2f
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/AuditBindListModel.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.AuditMgr;
+import org.apache.directory.fortress.core.rbac.Bind;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.UserAudit;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AuditBindListModel extends Model<SerializableList<Bind>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private AuditMgr auditMgr;
+ private static final Logger LOG = Logger.getLogger( AuditBindListModel.class.getName() );
+ private transient UserAudit userAudit;
+ private transient SerializableList<Bind> binds = null;
+
+ /**
+ * Default constructor
+ */
+ public AuditBindListModel( Session session )
+ {
+ Injector.get().inject( this );
+ auditMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param userAudit
+ */
+ public AuditBindListModel( UserAudit userAudit, Session session )
+ {
+ Injector.get().inject( this );
+ this.userAudit = userAudit;
+ auditMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Role> roles data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<Bind> getObject()
+ {
+ if ( binds != null )
+ {
+ LOG.debug( ".getObject count: " + binds.size() );
+ return binds;
+ }
+
+ // if caller did not set userId return an empty list:
+ if ( ( userAudit == null ) ||
+ (
+ !VUtil.isNotNullOrEmpty( userAudit.getUserId() ) &&
+ ( userAudit.getBeginDate() == null ) &&
+ ( userAudit.getEndDate() == null )
+ )
+ )
+ {
+ LOG.debug(".getObject null");
+ binds = new SerializableList<>( new ArrayList<Bind>() );
+ }
+ else
+ {
+ // get the list of matching bind records from fortress:
+ binds = new SerializableList<>( getList(userAudit) );
+ }
+
+ return binds;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<Bind> object )
+ {
+ LOG.debug( ".setObject count: " + object.size() );
+ this.binds = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ binds = null;
+ userAudit = null;
+ }
+
+
+ private List<Bind> getList( UserAudit userAudit )
+ {
+ List<Bind> bindList = null;
+
+ try
+ {
+ bindList = auditMgr.searchBinds( userAudit );
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return bindList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/AuditModListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/AuditModListModel.java b/src/main/java/org/apache/directory/fortress/web/model/AuditModListModel.java
new file mode 100644
index 0000000..aa052fd
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/AuditModListModel.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.AuditMgr;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.Mod;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.User;
+import org.apache.directory.fortress.core.rbac.UserAudit;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AuditModListModel extends Model<SerializableList<Mod>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private AuditMgr auditMgr;
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger LOG = Logger.getLogger(AuditModListModel.class.getName());
+ private transient UserAudit userAudit;
+ private transient SerializableList<Mod> mods = null;
+
+ /**
+ * Default constructor
+ */
+ public AuditModListModel( final Session session )
+ {
+ Injector.get().inject(this);
+ auditMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param userAudit
+ */
+ public AuditModListModel( UserAudit userAudit, Session session )
+ {
+ Injector.get().inject(this);
+ this.userAudit = userAudit;
+ auditMgr.setAdmin( session );
+ }
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Role> roles data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<Mod> getObject()
+ {
+ if (mods != null)
+ {
+ LOG.debug( ".getObject count: " + mods.size() );
+ return mods;
+ }
+
+ // if caller did not set userId return an empty list:
+ if ( ( userAudit == null ) ||
+ (
+ !VUtil.isNotNullOrEmpty( userAudit.getUserId() ) &&
+ !VUtil.isNotNullOrEmpty( userAudit.getObjName() ) &&
+ !VUtil.isNotNullOrEmpty( userAudit.getOpName() ) &&
+ ( userAudit.getBeginDate() == null ) &&
+ ( userAudit.getEndDate() == null )
+ )
+ )
+ {
+ LOG.debug( ".getObject null" );
+ mods = new SerializableList<>( new ArrayList<Mod>() );
+ }
+ else
+ {
+ // do we need to retrieve the internalUserId (which is what maps to admin modification record in slapd audit log?
+ if ( VUtil.isNotNullOrEmpty( userAudit.getUserId()) && !VUtil.isNotNullOrEmpty( userAudit.getInternalUserId() ) )
+ {
+ User user = getUser( userAudit );
+
+ if ( user == null )
+ {
+ String warning = "Matching user not found for userId: " + userAudit.getUserId();
+ LOG.warn( warning );
+ throw new RuntimeException( warning );
+ }
+
+ userAudit.setInternalUserId( user.getInternalId() );
+ }
+
+ mods = new SerializableList<>( getList( userAudit ) );
+ }
+
+ return mods;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<Mod> object )
+ {
+ LOG.debug(".setObject count: " + object.size() );
+ this.mods = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ this.mods = null;
+ userAudit = null;
+ }
+
+
+ private List<Mod> getList( UserAudit userAudit )
+ {
+ List<Mod> modList = null;
+
+ try
+ {
+ userAudit.setDn( "" );
+
+ if (VUtil.isNotNullOrEmpty( userAudit.getObjName() ) )
+ {
+ userAudit.setObjName( getTruncatedObjName( userAudit.getObjName() ) );
+ }
+
+ modList = auditMgr.searchAdminMods( userAudit );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn(error);
+ }
+
+ return modList;
+ }
+
+
+ /**
+ * Utility will parse a String containing objName.operationName and return the objName only.
+ *
+ * @param szObj contains raw data format.
+ * @return String containing objName.
+ */
+ private String getTruncatedObjName( String szObj )
+ {
+ int indx = szObj.lastIndexOf( '.' );
+
+ if ( indx == -1 )
+ {
+ return szObj;
+ }
+
+ return szObj.substring( indx + 1 );
+ }
+
+
+ private User getUser( UserAudit userAudit )
+ {
+ User user = null;
+
+ try
+ {
+ user = reviewMgr.readUser( new User ( userAudit.getUserId() ) );
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getUser caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return user;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/GroupListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/GroupListModel.java b/src/main/java/org/apache/directory/fortress/web/model/GroupListModel.java
new file mode 100644
index 0000000..54f6504
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/GroupListModel.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.ldap.group.Group;
+import org.apache.directory.fortress.core.ldap.group.GroupMgr;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.User;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class GroupListModel extends Model<SerializableList<Group>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private GroupMgr groupMgr;
+ private static final Logger LOG = Logger.getLogger( GroupListModel.class.getName() );
+ private transient Group group;
+ private transient SerializableList<Group> groups = null;
+
+ /**
+ * Default constructor
+ */
+ public GroupListModel( Session session )
+ {
+ Injector.get().inject( this );
+ groupMgr.setAdmin( session );
+ }
+
+
+ /**
+ * Group contains the search arguments.
+ *
+ * @param group
+ */
+ public GroupListModel( Group group, Session session )
+ {
+ Injector.get().inject( this );
+ this.group = group;
+ groupMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for {@link org.apache.directory.fortress.web.panel.ObjectListPanel}
+ *
+ * @return T extends List<User> users data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<Group> getObject()
+ {
+ if ( groups != null )
+ {
+ LOG.debug( ".getObject count: " + groups.size() );
+ return groups;
+ }
+
+ if ( group == null )
+ {
+ LOG.debug( ".getObject null" );
+ groups = new SerializableList<>( new ArrayList<Group>() );
+ }
+ else
+ {
+ LOG.debug( ".getObject group name: " + group.getName() );
+ List<Group> foundGroups = getList( group );
+ if(VUtil.isNotNullOrEmpty( foundGroups ))
+ {
+ groups = new SerializableList<>( foundGroups );
+ }
+ else
+ {
+ groups = new SerializableList<>( new ArrayList<Group>() );
+ }
+ }
+ return groups;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<Group> object )
+ {
+ LOG.debug(".setObject count: " + object.size() );
+ groups = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ groups = null;
+ group = null;
+ }
+
+
+ public List<Group> getList( Group group )
+ {
+ List<Group> groupList = null;
+
+ try
+ {
+ if ( VUtil.isNotNullOrEmpty( group.getMembers() ) )
+ {
+ String userId = group.getMembers().get( 0 );
+ LOG.debug( ".getList userId name: " + userId );
+ groupList = groupMgr.find( new User( userId ) );
+ }
+ else
+ {
+ LOG.debug( ".getList group name: " + group.getName() );
+ groupList = groupMgr.find( group );
+ }
+ // sort list by name:
+ if( VUtil.isNotNullOrEmpty( groupList ))
+ {
+ Collections.sort( groupList, new Comparator<Group>()
+ {
+ @Override
+ public int compare(Group g1, Group g2)
+ {
+ return g1.getName().compareToIgnoreCase( g2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return groupList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/OUListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/OUListModel.java b/src/main/java/org/apache/directory/fortress/web/model/OUListModel.java
new file mode 100644
index 0000000..520d1d8
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/OUListModel.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.DelReviewMgr;
+import org.apache.directory.fortress.core.rbac.OrgUnit;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class OUListModel extends Model<SerializableList<OrgUnit>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private DelReviewMgr delReviewMgr;
+ private static final Logger LOG = Logger.getLogger( OUListModel.class.getName() );
+ private transient OrgUnit orgUnit;
+ private transient SerializableList<OrgUnit> orgUnits = null;
+
+ /**
+ * Default constructor
+ */
+ public OUListModel( boolean isUser, Session session )
+ {
+ Injector.get().inject( this );
+ delReviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param orgUnit
+ */
+ public OUListModel( OrgUnit orgUnit, Session session )
+ {
+ Injector.get().inject( this );
+ this.orgUnit = orgUnit;
+ delReviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for SDListPanel
+ *
+ * @return T extends List<OrgUnit> orgUnits data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<OrgUnit> getObject()
+ {
+ if ( orgUnits != null )
+ {
+ LOG.debug( ".getObject count: " + orgUnits.size() );
+ return orgUnits;
+ }
+
+ if ( orgUnit == null )
+ {
+ LOG.debug( ".getObject null" );
+ orgUnits = new SerializableList<>( new ArrayList<OrgUnit>() );
+ }
+ else
+ {
+ LOG.debug( ".getObject orgUnitNm: " + orgUnit.getName() );
+ orgUnits = new SerializableList<>( getList( orgUnit ) );
+ }
+
+ return orgUnits;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<OrgUnit> object )
+ {
+ LOG.debug( ".setObject count: " + ( object ).size() );
+ orgUnits = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug( ".detach" );
+ orgUnits = null;
+ orgUnit = null;
+ }
+
+
+ private List<OrgUnit> getList( OrgUnit orgUnit )
+ {
+ List<OrgUnit> orgUnitList = null;
+ if( orgUnit == null || orgUnit.getType() == null )
+ {
+ throw new RuntimeException( "Orgunit invalid state" );
+ }
+ try
+ {
+ String szOrgUnitNm = orgUnit.getName();
+ LOG.debug( ".getList orgUnitNm: " + szOrgUnitNm );
+ orgUnitList = delReviewMgr.search( orgUnit.getType(), orgUnit.getName() );
+ // sort list by name:
+ if( VUtil.isNotNullOrEmpty( orgUnitList ))
+ {
+ Collections.sort( ( orgUnitList ), new Comparator<OrgUnit>()
+ {
+ @Override
+ public int compare(OrgUnit o1, OrgUnit o2)
+ {
+ return o1.getName().compareToIgnoreCase( o2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return orgUnitList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/ObjectListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/ObjectListModel.java b/src/main/java/org/apache/directory/fortress/web/model/ObjectListModel.java
new file mode 100644
index 0000000..d5b40f0
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/ObjectListModel.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.OrgUnit;
+import org.apache.directory.fortress.core.rbac.PermObj;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ObjectListModel extends Model<SerializableList<PermObj>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger LOG = Logger.getLogger( ObjectListModel.class.getName() );
+ private transient PermObj permObj;
+ private transient SerializableList<PermObj> permObjs = null;
+ private boolean isAdmin;
+
+ /**
+ * Default constructor
+ */
+ public ObjectListModel( boolean isAdmin, Session session)
+ {
+ Injector.get().inject(this);
+ this.isAdmin = isAdmin;
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param permObj
+ */
+ public ObjectListModel( PermObj permObj, boolean isAdmin, Session session )
+ {
+ Injector.get().inject(this);
+ this.permObj = permObj;
+ this.isAdmin = isAdmin;
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for {@link org.apache.directory.fortress.web.panel.ObjectListPanel}
+ *
+ * @return T extends List<User> users data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<PermObj> getObject()
+ {
+ if (permObjs != null)
+ {
+ LOG.debug(".getObject count: " + permObjs.size() );
+ return permObjs;
+ }
+
+ if (permObj == null)
+ {
+ LOG.debug(".getObject null");
+ permObjs = new SerializableList<>( new ArrayList<PermObj>());
+ }
+ else
+ {
+ LOG.debug(".getObject userId: " + permObj.getObjName());
+ permObjs = new SerializableList<>( getList(permObj) );
+ }
+
+ return permObjs;
+ }
+
+
+ @Override
+ public void setObject(SerializableList<PermObj> object)
+ {
+ LOG.debug(".setObject count: " + object.size() );
+ this.permObjs = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.permObjs = null;
+ this.permObj = null;
+ }
+
+
+ public List<PermObj> getList(PermObj permObj)
+ {
+ List<PermObj> permObjList = null;
+
+ try
+ {
+ LOG.debug( ".getList permObjectName:" + permObj.getObjName() );
+
+ String ou = permObj.getOu();
+
+ if ( Strings.isEmpty( ou ) )
+ {
+ if ( isAdmin )
+ {
+ permObj.setAdmin( true );
+ }
+
+ permObjList = reviewMgr.findPermObjs( permObj );
+ }
+ else
+ {
+ // TODO: make this work with administrative permissions:
+ permObjList = reviewMgr.findPermObjs( new OrgUnit( ou ) );
+ }
+ // sort list by objName:
+ if( VUtil.isNotNullOrEmpty( permObjList ))
+ {
+ Collections.sort( permObjList, new Comparator<PermObj>()
+ {
+ @Override
+ public int compare(PermObj p1, PermObj p2)
+ {
+ return p1.getObjName().compareToIgnoreCase( p2.getObjName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ LOG.warn( ".getList caught SecurityException={}", se );
+ }
+
+ return permObjList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/PermListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/PermListModel.java b/src/main/java/org/apache/directory/fortress/web/model/PermListModel.java
new file mode 100644
index 0000000..96dde9f
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/PermListModel.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class PermListModel extends Model<SerializableList<Permission>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger LOG = Logger.getLogger(PermListModel.class.getName());
+ private transient Permission perm;
+ private transient SerializableList<Permission> perms = null;
+ private boolean isAdmin;
+
+ public PermListModel( boolean isAdmin, Session session )
+ {
+ Injector.get().inject( this );
+ this.isAdmin = isAdmin;
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param perm
+ */
+ public PermListModel( Permission perm, boolean isAdmin, Session session )
+ {
+ Injector.get().inject( this );
+ this.isAdmin = isAdmin;
+ this.perm = perm;
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Permission> perms data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<Permission> getObject()
+ {
+ if ( perms != null )
+ {
+ LOG.debug( ".getObject count: " + perms.size() );
+
+ return perms;
+ }
+
+ if (perm == null)
+ {
+ LOG.debug( ".getObject null ");
+ perms = new SerializableList<>( new ArrayList<Permission>() );
+ }
+ else
+ {
+ LOG.debug( " .getObject perm objectNm: " + perm.getObjName() );
+ LOG.debug( " .getObject perm opNm: " + perm.getOpName() );
+ perms = new SerializableList<>( getList( perm ) );
+ }
+
+ return perms;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<Permission> object )
+ {
+ LOG.debug( ".setObject count: " + object.size() );
+ this.perms = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.perms = null;
+ this.perm = null;
+ }
+
+
+ private List<Permission> getList( Permission perm )
+ {
+ List<Permission> permsList = null;
+ if( perm == null )
+ {
+ throw new RuntimeException( "Invalid permission state");
+ }
+
+ try
+ {
+ String szObjectNm = perm.getObjName();
+ String szOpNm = perm.getOpName();
+ LOG.debug( ".getList objectNm: " + szObjectNm + " opNm: " + szOpNm );
+ perm.setAdmin( isAdmin );
+ permsList = reviewMgr.findPermissions( perm );
+ // sort list by abstract name:
+ if( VUtil.isNotNullOrEmpty( permsList ))
+ {
+ Collections.sort( permsList, new Comparator<Permission>()
+ {
+ @Override
+ public int compare(Permission p1, Permission p2)
+ {
+ return p1.getAbstractName().compareToIgnoreCase( p2.getAbstractName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return permsList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/PwPolicyListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/PwPolicyListModel.java b/src/main/java/org/apache/directory/fortress/web/model/PwPolicyListModel.java
new file mode 100644
index 0000000..145c290
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/PwPolicyListModel.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.PwPolicyMgr;
+import org.apache.directory.fortress.core.rbac.PwPolicy;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class PwPolicyListModel extends Model<SerializableList<PwPolicy>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private PwPolicyMgr pwPolicyMgr;
+ private static final Logger LOG = Logger.getLogger(PwPolicyListModel.class.getName());
+ private transient PwPolicy policy;
+ private transient SerializableList<PwPolicy> policies = null;
+
+ /**
+ * Default constructor
+ */
+ public PwPolicyListModel( Session session )
+ {
+ Injector.get().inject(this);
+ // TODO: enable this after search permission added:
+ //this.pwPolicyMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param policy
+ */
+ public PwPolicyListModel( PwPolicy policy, Session session )
+ {
+ Injector.get().inject( this );
+ this.policy = policy;
+ // TODO: enable this after search permission added:
+ //this.pwPolicyMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Role> roles data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<PwPolicy> getObject()
+ {
+ if ( policies != null )
+ {
+ LOG.debug( ".getObject count: " + policies.size() );
+ return policies;
+ }
+
+ if ( policy == null )
+ {
+ LOG.debug( ".getObject null" );
+ policies = new SerializableList<>( new ArrayList<PwPolicy>() );
+ }
+ else
+ {
+ LOG.debug( ".getObject policyNm: " + policy.getName() );
+ policies = new SerializableList<>( getList( policy ) );
+ }
+
+ return policies;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<PwPolicy> object )
+ {
+ LOG.debug( ".setObject count: " + (object).size() );
+ policies = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ policies = null;
+ policy = null;
+ }
+
+ private List<PwPolicy> getList( PwPolicy policy )
+ {
+ List<PwPolicy> policiesList = null;
+
+ try
+ {
+ String szPolicyNm = policy != null ? policy.getName() : "";
+ LOG.debug( ".getList policyNm: " + szPolicyNm );
+ policiesList = pwPolicyMgr.search( szPolicyNm );
+ // sort list by policy name:
+ if( VUtil.isNotNullOrEmpty( policiesList ))
+ {
+ Collections.sort( policiesList, new Comparator<PwPolicy>()
+ {
+ @Override
+ public int compare(PwPolicy p1, PwPolicy p2)
+ {
+ return p1.getName().compareToIgnoreCase( p2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return policiesList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/RoleListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/RoleListModel.java b/src/main/java/org/apache/directory/fortress/web/model/RoleListModel.java
new file mode 100644
index 0000000..094c6ab
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/RoleListModel.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.DelReviewMgr;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.AdminRole;
+import org.apache.directory.fortress.core.rbac.Role;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class RoleListModel extends Model<SerializableList<? extends Role>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ @SpringBean
+ private DelReviewMgr delReviewMgr;
+ private static final Logger LOG = Logger.getLogger(RoleListModel.class.getName());
+ private transient Role role;
+ private transient SerializableList<? extends Role> roles = null;
+ private boolean isAdmin;
+
+
+ public RoleListModel( boolean isAdmin, Session session )
+ {
+ Injector.get().inject( this );
+ this.isAdmin = isAdmin;
+ this.reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param role
+ */
+ public RoleListModel( Role role, boolean isAdmin, Session session )
+ {
+ Injector.get().inject( this );
+ this.role = role;
+ this.isAdmin = isAdmin;
+ this.reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for RoleListPanel
+ *
+ * @return T extends List<Role> roles data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<? extends Role> getObject()
+ {
+ if ( roles != null )
+ {
+ LOG.debug(".getObject count: " + roles.size() );
+ return roles;
+ }
+
+ if ( role == null )
+ {
+ LOG.debug(".getObject null");
+ roles = new SerializableList<>( new ArrayList<Role>() );
+ }
+ else
+ {
+ LOG.debug(".getObject roleNm: " + role.getName() );
+
+ if ( isAdmin )
+ {
+ roles = new SerializableList<>( getAdminList( ( role ).getName() ) );
+ }
+ else
+ {
+ roles = new SerializableList<>( getList( role.getName() ) );
+ }
+ }
+
+ return roles;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<? extends Role> object )
+ {
+ LOG.debug(".setObject count: " + object.size() );
+ this.roles = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ roles = null;
+ role = null;
+ }
+
+
+ private List<Role> getList( String szRoleNm )
+ {
+ List<Role> rolesList = null;
+
+ try
+ {
+ LOG.debug( ".getList roleNm: " + szRoleNm );
+ rolesList = reviewMgr.findRoles( szRoleNm );
+ // sort list by role name:
+ if( VUtil.isNotNullOrEmpty( rolesList ))
+ {
+ Collections.sort( rolesList, new Comparator<Role>()
+ {
+ @Override
+ public int compare(Role r1, Role r2)
+ {
+ return r1.getName().compareToIgnoreCase( r2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error) ;
+ }
+
+ return rolesList;
+ }
+
+
+ private List<AdminRole> getAdminList( String szRoleNm )
+ {
+ List<AdminRole> rolesList = null;
+
+ try
+ {
+ LOG.debug( ".getList roleNm: " + szRoleNm );
+ rolesList = delReviewMgr.findRoles( szRoleNm );
+ if( VUtil.isNotNullOrEmpty( rolesList ))
+ {
+ Collections.sort( rolesList, new Comparator<AdminRole>()
+ {
+ @Override
+ public int compare(AdminRole r1, AdminRole r2)
+ {
+ return r1.getName().compareToIgnoreCase( r2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getAdminList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return rolesList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/SDListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/SDListModel.java b/src/main/java/org/apache/directory/fortress/web/model/SDListModel.java
new file mode 100644
index 0000000..ec29ea0
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/SDListModel.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.Role;
+import org.apache.directory.fortress.core.rbac.SDSet;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SDListModel extends Model<SerializableList<SDSet>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger LOG = Logger.getLogger(SDListModel.class.getName());
+ private transient SDSet sdSet;
+ private transient SerializableList<SDSet> sdSets = null;
+
+ /**
+ * Default constructor
+ */
+ public SDListModel( boolean isStatic, Session session )
+ {
+ Injector.get().inject( this );
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param sdSet
+ */
+ public SDListModel( SDSet sdSet, final Session session )
+ {
+ Injector.get().inject( this );
+ this.sdSet = sdSet;
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for SDListPanel
+ *
+ * @return T extends List<SDSet> sdSets data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<SDSet> getObject()
+ {
+ if ( sdSets != null )
+ {
+ LOG.debug( ".getObject count: " + sdSets.size() );
+ return sdSets;
+ }
+
+ if ( sdSet == null )
+ {
+ LOG.debug( ".getObject null" );
+ sdSets = new SerializableList<>( new ArrayList<SDSet>() );
+ }
+ else
+ {
+ LOG.debug( ".getObject sdSetNm: " + sdSet.getName() );
+ sdSets = new SerializableList<>( getList( sdSet ) );
+ }
+
+ return sdSets;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<SDSet> object )
+ {
+ LOG.debug( ".setObject count: " + object.size() );
+ sdSets = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ sdSets = null;
+ sdSet = null;
+ }
+
+
+ private List<SDSet> getList( SDSet sdSet )
+ {
+ List<SDSet> sdSetList = null;
+
+ if( sdSet == null )
+ {
+ throw new RuntimeException( "Invalid SDSet State" );
+ }
+
+ try
+ {
+ String szSdSetNm = sdSet.getName();
+ LOG.debug( ".getList sdSetNm: " + szSdSetNm );
+
+ if ( VUtil.isNotNullOrEmpty( sdSet.getMembers() ) )
+ {
+ Object[] roleNms = sdSet.getMembers().toArray();
+ String szRoleNm = (String)roleNms[0];
+ Role role = new Role( szRoleNm );
+
+ if ( sdSet.getType().equals( SDSet.SDType.STATIC ) )
+ {
+ sdSetList = reviewMgr.ssdRoleSets( role );
+ }
+ else
+ {
+ sdSetList = reviewMgr.dsdRoleSets( role );
+ }
+ }
+ else
+ {
+ if ( sdSet.getType().equals( SDSet.SDType.STATIC ) )
+ {
+ sdSetList = reviewMgr.ssdSets( sdSet );
+ }
+ else
+ {
+ sdSetList = reviewMgr.dsdSets( sdSet );
+ }
+ }
+ // sort list by set name:
+ if( VUtil.isNotNullOrEmpty( sdSetList ))
+ {
+ Collections.sort( sdSetList, new Comparator<SDSet>()
+ {
+ @Override
+ public int compare(SDSet s1, SDSet s2)
+ {
+ return s1.getName().compareToIgnoreCase( s2.getName() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ LOG.warn( error );
+ }
+
+ return sdSetList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/SerializableList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/SerializableList.java b/src/main/java/org/apache/directory/fortress/web/model/SerializableList.java
new file mode 100644
index 0000000..2caa8da
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/SerializableList.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+public class SerializableList<E> implements List<E>, Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private List<E> list;
+
+ public SerializableList( List<E> list )
+ {
+ this.list = list;
+ }
+
+ @Override
+ public int size()
+ {
+ return list.size();
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return list.isEmpty();
+ }
+
+ @Override
+ public boolean contains( Object o )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Iterator<E> iterator()
+ {
+ return list.iterator();
+ }
+
+ @Override
+ public Object[] toArray()
+ {
+ return list.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray( T[] a )
+ {
+ return list.toArray( a );
+ }
+
+ @Override
+ public boolean add( E e )
+ {
+ return list.add( e );
+ }
+
+ @Override
+ public boolean remove( Object o )
+ {
+ return list.remove( o );
+ }
+
+ @Override
+ public boolean containsAll( Collection<?> c )
+ {
+ return list.containsAll( c );
+ }
+
+ @Override
+ public boolean addAll( Collection<? extends E> c )
+ {
+ return list.addAll( c );
+ }
+
+ @Override
+ public boolean addAll( int index, Collection<? extends E> c )
+ {
+ return list.addAll( index, c );
+ }
+
+ @Override
+ public boolean removeAll( Collection<?> c )
+ {
+ return list.removeAll( c );
+ }
+
+ @Override
+ public boolean retainAll( Collection<?> c )
+ {
+ return list.retainAll( c );
+ }
+
+ @Override
+ public void clear()
+ {
+ list.clear();
+ }
+
+ @Override
+ public E get( int index )
+ {
+ return list.get( index );
+ }
+
+ @Override
+ public E set( int index, E element )
+ {
+ return list.set( index, element );
+ }
+
+ @Override
+ public void add( int index, E element )
+ {
+ list.add( index, element );
+ }
+
+ @Override
+ public E remove( int index )
+ {
+ return list.remove( index );
+ }
+
+ @Override
+ public int indexOf( Object o )
+ {
+ return list.indexOf( o );
+ }
+
+ @Override
+ public int lastIndexOf( Object o )
+ {
+ return list.lastIndexOf( o );
+ }
+
+ @Override
+ public ListIterator<E> listIterator()
+ {
+ return list.listIterator();
+ }
+
+ @Override
+ public ListIterator<E> listIterator( int index )
+ {
+ return list.listIterator( index );
+ }
+
+ @Override
+ public List<E> subList( int fromIndex, int toIndex )
+ {
+ return list.subList( fromIndex, toIndex );
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java b/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
new file mode 100644
index 0000000..187fca4
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.model;
+
+import org.apache.log4j.Logger;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.web.panel.UserListPanel;
+import org.apache.directory.fortress.core.DelReviewMgr;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.rbac.AdminRole;
+import org.apache.directory.fortress.core.rbac.OrgUnit;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Role;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.User;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.fortress.core.SecurityException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class UserListModel extends Model<SerializableList<User>>
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ @SpringBean
+ private DelReviewMgr delReviewMgr;
+ private static final Logger log = Logger.getLogger(UserListModel.class.getName());
+ private transient User user;
+ private transient Permission perm;
+ private transient SerializableList<User> users = null;
+
+ /**
+ * Default constructor
+ */
+ public UserListModel( Session session )
+ {
+ init( session );
+ }
+
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param user
+ */
+ public UserListModel( User user, Session session )
+ {
+ this.user = user;
+ init( session );
+ log.debug( "constructor userId: " + user.getUserId() );
+ }
+
+
+ public UserListModel( Permission perm, Session session )
+ {
+ this.perm = perm;
+ init( session );
+ log.debug( "constructor perm: " + perm.getObjName() );
+ }
+
+
+ private void init( Session session )
+ {
+ Injector.get().inject( this );
+ reviewMgr.setAdmin( session );
+ }
+
+
+ /**
+ * This data is bound for {@link UserListPanel}
+ *
+ * @return T extends List<User> users data will be bound to panel data view component.
+ */
+ @Override
+ public SerializableList<User> getObject()
+ {
+ if (users != null)
+ {
+ log.debug( ".getObject count: " + users.size() );
+ return users;
+ }
+
+ if ( ( user == null ) && ( perm == null ))
+ {
+ log.debug( ".getObject null" );
+ users = new SerializableList<>( new ArrayList<User>() );
+ }
+ else
+ {
+ //log.debug(".getObject userId: " + user != null ? user.getUserId() : "null");
+ users = new SerializableList<>( getList( user ) );
+ }
+
+ return users;
+ }
+
+
+ @Override
+ public void setObject( SerializableList<User> object )
+ {
+ log.debug(".setObject count: " + object.size() );
+ users = object;
+ }
+
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ users = null;
+ user = null;
+ }
+
+
+ public List<User> getList(User user)
+ {
+ List<User> usersList = null;
+
+ try
+ {
+ if ( perm != null )
+ {
+ Set<String> users = reviewMgr.authorizedPermissionUsers( perm );
+
+ if ( VUtil.isNotNullOrEmpty( users ) )
+ {
+ usersList = new ArrayList<>();
+
+ for(String userId : users)
+ {
+ User user1 = reviewMgr.readUser( new User( userId ) );
+ usersList.add( user1 );
+ }
+ }
+ }
+ else if( VUtil.isNotNullOrEmpty( user.getOu() ) )
+ {
+ usersList = reviewMgr.findUsers( new OrgUnit( user.getOu(), OrgUnit.Type.USER ) );
+ }
+ else if ( VUtil.isNotNullOrEmpty( user.getRoles() ) )
+ {
+ usersList = reviewMgr.assignedUsers( new Role( user.getRoles().get( 0 ).getName() ) );
+ }
+ else if ( VUtil.isNotNullOrEmpty( user.getAdminRoles() ) )
+ {
+ usersList = delReviewMgr.assignedUsers( new AdminRole( user.getAdminRoles().get( 0 ).getName() ) );
+ }
+ else
+ {
+ usersList = reviewMgr.findUsers( user );
+ }
+ // sort list by userId:
+ if( VUtil.isNotNullOrEmpty( usersList ))
+ {
+ Collections.sort( usersList, new Comparator<User>()
+ {
+ @Override
+ public int compare(User u1, User u2)
+ {
+ return u1.getUserId().compareToIgnoreCase( u2.getUserId() );
+ }
+ } );
+ }
+ }
+ catch ( SecurityException se )
+ {
+ String error = ".getList caught SecurityException=" + se;
+ log.warn( error );
+ }
+
+ return usersList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzDetailPanel.java
index 9bd9174..65f8d63 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzDetailPanel.java
@@ -21,9 +21,8 @@
package org.apache.directory.fortress.web.panel;
-import org.apache.directory.fortress.web.AuditUtils;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SelectModelEvent;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -34,7 +33,7 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.directory.fortress.core.*;
import org.apache.directory.fortress.core.rbac.AuthZ;
import org.apache.directory.fortress.core.rbac.User;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzListPanel.java
index d8ae2f2..c5ec460 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditAuthzListPanel.java
@@ -25,7 +25,6 @@ import com.googlecode.wicket.kendo.ui.form.datetime.DatePicker;
import com.inmethod.grid.IGridColumn;
import com.inmethod.grid.column.PropertyColumn;
import com.inmethod.grid.treegrid.TreeGrid;
-import org.apache.directory.fortress.web.AuditUtils;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -39,13 +38,13 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
-import org.apache.directory.fortress.web.AuditAuthzListModel;
+import org.apache.directory.fortress.web.model.AuditAuthzListModel;
import org.apache.directory.fortress.web.AuditAuthzPage;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxLink;
-import org.apache.directory.fortress.web.SelectModelEvent;
+import org.apache.directory.fortress.web.common.GlobalIds;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxLink;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.rbac.AuthZ;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
@@ -75,7 +74,6 @@ public class AuditAuthzListPanel extends FormComponentPanel
private static final long serialVersionUID = 1L;
private static final Logger LOG = Logger.getLogger( AuditAuthzListPanel.class.getName() );
private Form listForm;
- private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
private DefaultMutableTreeNode rootNode;
@@ -372,7 +370,7 @@ public class AuditAuthzListPanel extends FormComponentPanel
columns.add( reqResult );
List<AuthZ> authZs = ( List<AuthZ> ) getDefaultModel().getObject();
- treeModel = createTreeModel( authZs );
+ DefaultTreeModel treeModel = createTreeModel( authZs );
grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>( "authztreegrid", treeModel, columns )
{
/** Default serialVersionUID */
@@ -407,7 +405,7 @@ public class AuditAuthzListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
grid.setOutputMarkupId( true );
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditBindDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindDetailPanel.java
index 4cc23dd..73b1df4 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditBindDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindDetailPanel.java
@@ -21,9 +21,8 @@
package org.apache.directory.fortress.web.panel;
-import org.apache.directory.fortress.web.AuditUtils;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SelectModelEvent;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -34,7 +33,7 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.directory.fortress.core.*;
import org.apache.directory.fortress.core.rbac.Bind;
import org.apache.directory.fortress.core.rbac.User;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditBindListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindListPanel.java
index e5482d6..046c212 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditBindListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditBindListPanel.java
@@ -26,7 +26,6 @@ import com.inmethod.grid.IGridColumn;
import com.inmethod.grid.column.PropertyColumn;
import com.inmethod.grid.treegrid.TreeGrid;
-import org.apache.directory.fortress.web.AuditUtils;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -40,14 +39,14 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
-import org.apache.directory.fortress.web.AuditBindListModel;
+import org.apache.directory.fortress.web.model.AuditBindListModel;
import org.apache.directory.fortress.web.AuditBindPage;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxLink;
-import org.apache.directory.fortress.web.SelectModelEvent;
-import org.apache.directory.fortress.web.SerializableList;
+import org.apache.directory.fortress.web.common.GlobalIds;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxLink;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
+import org.apache.directory.fortress.web.model.SerializableList;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
import org.apache.directory.fortress.core.rbac.Bind;
@@ -77,14 +76,12 @@ public class AuditBindListPanel extends FormComponentPanel
private static final long serialVersionUID = 1L;
private static final Logger LOG = Logger.getLogger( AuditBindListPanel.class.getName() );
private Form listForm;
- private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
private DefaultMutableTreeNode rootNode;
private TextField userFld;
protected DatePicker beginDateDP;
protected DatePicker endDateDP;
- private IModel<SerializableList<Bind>> pageModel;
public AuditBindListPanel( String id, UserAudit userAudit )
@@ -96,7 +93,7 @@ public class AuditBindListPanel extends FormComponentPanel
private void init( UserAudit userAudit )
{
- pageModel = new AuditBindListModel( userAudit, SecUtils.getSession( this ) );
+ IModel<SerializableList<Bind>> pageModel = new AuditBindListModel( userAudit, SecUtils.getSession( this ) );
setDefaultModel( pageModel );
createAndLoadGrid();
this.listForm = new Form( "bindform" );
@@ -297,7 +294,7 @@ public class AuditBindListPanel extends FormComponentPanel
columns.add( reqResult );
List<Bind> binds = ( List<Bind> ) getDefaultModel().getObject();
- treeModel = createTreeModel( binds );
+ DefaultTreeModel treeModel = createTreeModel( binds );
grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>( "bindtreegrid", treeModel, columns )
{
/** Default serialVersionUID */
@@ -331,7 +328,7 @@ public class AuditBindListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
grid.setOutputMarkupId( true );
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java
index 6766b68..b26efd7 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java
@@ -25,7 +25,6 @@ import com.googlecode.wicket.jquery.core.Options;
import com.googlecode.wicket.kendo.ui.datatable.DataTable;
import com.googlecode.wicket.kendo.ui.datatable.column.IColumn;
import com.googlecode.wicket.kendo.ui.datatable.column.PropertyColumn;
-import org.apache.directory.fortress.web.AuditUtils;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -39,9 +38,9 @@ import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SelectModelEvent;
+import org.apache.directory.fortress.web.common.GlobalIds;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AuditMgr;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.rbac.Mod;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditModListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditModListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditModListPanel.java
index 0a40bc2..c7c93ca 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/AuditModListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditModListPanel.java
@@ -38,14 +38,14 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
-import org.apache.directory.fortress.web.AuditModListModel;
+import org.apache.directory.fortress.web.model.AuditModListModel;
import org.apache.directory.fortress.web.AuditModPage;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxLink;
-import org.apache.directory.fortress.web.SelectModelEvent;
-import org.apache.directory.fortress.web.SerializableList;
+import org.apache.directory.fortress.web.common.GlobalIds;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxLink;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
+import org.apache.directory.fortress.web.model.SerializableList;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
import org.apache.directory.fortress.core.rbac.Mod;
@@ -76,7 +76,6 @@ public class AuditModListPanel extends FormComponentPanel
private static final long serialVersionUID = 1L;
private static final Logger LOG = Logger.getLogger( AuditModListPanel.class.getName() );
private Form listForm;
- private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
private DefaultMutableTreeNode rootNode;
@@ -86,7 +85,6 @@ public class AuditModListPanel extends FormComponentPanel
protected DatePicker beginDateDP;
protected DatePicker endDateDP;
private Permission permission;
- private IModel<SerializableList<Mod>> pageModel;
public AuditModListPanel( String id, UserAudit userAudit )
@@ -98,7 +96,7 @@ public class AuditModListPanel extends FormComponentPanel
private void init( UserAudit userAudit )
{
- pageModel = new AuditModListModel( userAudit, SecUtils.getSession( this ) );
+ IModel<SerializableList<Mod>> pageModel = new AuditModListModel( userAudit, SecUtils.getSession( this ) );
setDefaultModel( pageModel );
createAndLoadGrid();
this.listForm = new Form( "modform" );
@@ -318,7 +316,7 @@ public class AuditModListPanel extends FormComponentPanel
columns.add( reqAttrsOnly );
List<Mod> mods = ( List<Mod> ) getDefaultModel().getObject();
- treeModel = createTreeModel( mods );
+ DefaultTreeModel treeModel = createTreeModel( mods );
grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>( "modtreegrid", treeModel, columns )
{
/** Default serialVersionUID */
@@ -353,7 +351,7 @@ public class AuditModListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
grid.setOutputMarkupId( true );
}