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:42 UTC
[1/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
Repository: directory-fortress-commander
Updated Branches:
refs/heads/master e387f6cdb -> fe719b1bb
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/AuditUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/AuditUtils.java b/src/main/java/org/apache/directory/fortress/web/panel/AuditUtils.java
new file mode 100644
index 0000000..cf5e296
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/panel/AuditUtils.java
@@ -0,0 +1,206 @@
+package org.apache.directory.fortress.web.panel;
+
+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.User;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.log4j.Logger;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * Created by smckinn on 3/10/15.
+ */
+class AuditUtils
+{
+ private static final Logger LOG = Logger.getLogger( AuditUtils.class.getName() );
+
+ private AuditUtils()
+ {
+ }
+
+ /**
+ *
+ * @param raw
+ * @return
+ */
+ static Permission getAuthZPerm( String raw )
+ {
+ //// ftOpNm=addUser,ftObjNm=org.apache.directory.fortress.core.rbac.AdminMgrImpl,ou=AdminPerms,ou=ARBAC,dc=jts,dc=us
+ // ftObjId=006+ftOpNm=TOP1_6,ftObjNm=TOB1_4,ou=Permissions,ou=RBAC,dc=jts,dc=us
+
+ // TODO: use fortress GlobalIds instead:
+ final String OBJ_ID = "ftObjId";
+ final String OBJ_NM = "ftObjNm";
+ final String OP_NM = "ftOpNm";
+ Permission perm = new Permission();
+ int bindx = raw.indexOf( OBJ_ID );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.indexOf( "+" );
+ if ( eindx != -1 )
+ {
+ perm.setObjId( raw.substring( bindx + OBJ_ID.length() + 1, eindx ) );
+ }
+ }
+ bindx = raw.indexOf( OBJ_NM );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.substring( bindx ).indexOf( "," );
+ if ( eindx != -1 )
+ {
+ eindx += bindx;
+ perm.setObjName( raw.substring( bindx + OBJ_NM.length() + 1, eindx ) );
+ }
+ }
+ bindx = raw.indexOf( OP_NM );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.substring( bindx ).indexOf( "," );
+ if ( eindx != -1 )
+ {
+ eindx += bindx;
+ perm.setOpName( raw.substring( bindx + OP_NM.length() + 1, eindx ) );
+ }
+ }
+ return perm;
+ }
+
+ /**
+ *
+ * @param authZ
+ */
+ static void mapAuthZPerm( AuthZ authZ )
+ {
+ //// ftOpNm=addUser,ftObjNm=org.apache.directory.fortress.core.rbac.AdminMgrImpl,ou=AdminPerms,ou=ARBAC,dc=jts,dc=us
+ // ftObjId=006+ftOpNm=TOP1_6,ftObjNm=TOB1_4,ou=Permissions,ou=RBAC,dc=jts,dc=us
+ String raw = authZ.getReqDN();
+
+ // TODO: use fortress GlobalIds instead:
+ final String OBJ_ID = "ftObjId";
+ final String OBJ_NM = "ftObjNm";
+ final String OP_NM = "ftOpNm";
+
+ // TODO: fix this mapping:
+ //reqDerefAliases
+ //reqAttr
+ //reqAttrsOnly
+
+ //Permission perm = new Permission();
+ int bindx = raw.indexOf( OBJ_ID );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.indexOf( "+" );
+ if ( eindx != -1 )
+ {
+ authZ.setReqDerefAliases( raw.substring( bindx + OBJ_ID.length() + 1, eindx ) );
+ }
+ }
+ bindx = raw.indexOf( OBJ_NM );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.substring( bindx ).indexOf( "," );
+ if ( eindx != -1 )
+ {
+ eindx += bindx;
+ authZ.setReqAttr( raw.substring( bindx + OBJ_NM.length() + 1, eindx ) );
+ }
+ }
+ bindx = raw.indexOf( OP_NM );
+ if ( bindx != -1 )
+ {
+ int eindx = raw.substring( bindx ).indexOf( "," );
+ if ( eindx != -1 )
+ {
+ eindx += bindx;
+ authZ.setReqAttrsOnly( raw.substring( bindx + OP_NM.length() + 1, eindx ) );
+ }
+ }
+ }
+
+ /**
+ *
+ * @param inputString
+ * @return
+ */
+ static String getAuthZId( String inputString )
+ {
+ //reqAuthzID: uid=fttu3user4,ou=people,dc=jts,dc=com
+ String userId = null;
+ if ( inputString != null && inputString.length() > 0 )
+ {
+ StringTokenizer maxTkn = new StringTokenizer( inputString, "," );
+ if ( maxTkn.countTokens() > 0 )
+ {
+ String val = maxTkn.nextToken();
+ int indx = val.indexOf( '=' );
+ if ( indx >= 1 )
+ {
+ userId = val.substring( indx + 1 );
+ }
+ }
+ }
+ return userId;
+ }
+
+ /**
+ *
+ * @param reviewMgr
+ * @param userId
+ * @return
+ */
+ static User getUser( ReviewMgr reviewMgr, String userId )
+ {
+ User user = null;
+ try
+ {
+ user = reviewMgr.readUser( new User( userId ) );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "SecurityException=" + se;
+ LOG.warn( error );
+
+ }
+ return user;
+ }
+
+ /**
+ *
+ * @param reviewMgr
+ * @param internalId
+ * @return
+ */
+ static User getUserByInternalId( ReviewMgr reviewMgr, String internalId )
+ {
+ User user = null;
+ try
+ {
+ User inUser = new User();
+ inUser.setInternalId( internalId );
+ List<User> users = reviewMgr.findUsers( inUser );
+ if ( VUtil.isNotNullOrEmpty( users ) )
+ {
+ if ( users.size() > 1 )
+ {
+ String error = "Found: " + users.size() + " users matching internalId: " + internalId;
+ LOG.warn( error );
+ }
+ user = users.get( 0 );
+ }
+ else
+ {
+ String error = "Can't find user matching internalId: " + internalId;
+ LOG.warn( error );
+ }
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "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/panel/ConstraintAdminRolePanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/ConstraintAdminRolePanel.java b/src/main/java/org/apache/directory/fortress/web/panel/ConstraintAdminRolePanel.java
index dc74702..e6734eb 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/ConstraintAdminRolePanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/ConstraintAdminRolePanel.java
@@ -25,7 +25,7 @@ import com.googlecode.wicket.kendo.ui.form.datetime.DatePicker;
import com.googlecode.wicket.kendo.ui.form.datetime.TimePicker;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.directory.fortress.core.util.time.Constraint;
import java.util.Date;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
index 96a139f..49c2197 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
@@ -49,11 +49,11 @@ 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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
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.User;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
index 04841f4..9c89e62 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
@@ -38,13 +38,13 @@ import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.GroupListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.model.GroupListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+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.ldap.group.Group;
import org.apache.directory.fortress.core.rbac.FortEntity;
import org.apache.wicket.markup.html.form.Form;
@@ -308,7 +308,7 @@ public class GroupListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
this.listForm = new Form( "grouplistform" );
this.listForm.add( grid );
add( this.listForm );
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/NavPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/NavPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/NavPanel.java
index 2d99ba9..f06618e 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/NavPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/NavPanel.java
@@ -33,7 +33,7 @@ import org.apache.directory.fortress.web.AuditBindPage;
import org.apache.directory.fortress.web.AuditModPage;
import org.apache.directory.fortress.web.GroupPage;
import org.apache.directory.fortress.web.SdDynamicPage;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.directory.fortress.web.ObjectAdminPage;
import org.apache.directory.fortress.web.OuUserPage;
import org.apache.directory.fortress.web.ObjectPage;
@@ -44,7 +44,7 @@ import org.apache.directory.fortress.web.PwPolicyPage;
import org.apache.directory.fortress.web.RoleAdminPage;
import org.apache.directory.fortress.web.RolePage;
import org.apache.directory.fortress.web.SdStaticPage;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
import org.apache.directory.fortress.web.UserPage;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/OUDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/OUDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/OUDetailPanel.java
index 8a99399..2da7d3d 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/OUDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/OUDetailPanel.java
@@ -39,11 +39,11 @@ 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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.DelAdminMgr;
import org.apache.directory.fortress.core.rbac.OrgUnit;
import org.apache.directory.fortress.core.util.attr.VUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/OUListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/OUListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/OUListPanel.java
index 1b459e2..346712f 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/OUListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/OUListPanel.java
@@ -34,12 +34,12 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.OUListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.model.OUListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.rbac.FortEntity;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
@@ -63,13 +63,11 @@ public class OUListPanel extends FormComponentPanel
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger( OUListPanel.class.getName() );
- private Form listForm;
private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
private DefaultMutableTreeNode rootNode;
private String searchVal;
- private String searchLabel;
public OUListPanel( String id, final boolean isUser )
@@ -77,6 +75,7 @@ public class OUListPanel extends FormComponentPanel
super( id );
OrgUnit orgUnit = new OrgUnit();
orgUnit.setName( "" );
+ String searchLabel;
if ( isUser )
{
orgUnit.setType( OrgUnit.Type.USER );
@@ -142,23 +141,23 @@ public class OUListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
- this.listForm = new Form( "form" );
- this.listForm.add( grid );
+ grid.getTreeState().expandAll();
+ Form listForm = new Form( "form" );
+ listForm.add( grid );
grid.setOutputMarkupId( true );
TextField searchValFld = new TextField( GlobalIds.SEARCH_VAL, new PropertyModel<String>( this,
GlobalIds.SEARCH_VAL ) );
- this.listForm.add( searchValFld );
+ listForm.add( searchValFld );
//this.listForm.add( new AjaxSubmitLink( "search" )
- this.listForm.add( new SecureIndicatingAjaxButton( GlobalIds.SEARCH, GlobalIds.DEL_REVIEW_MGR, "searchOU" )
+ listForm.add( new SecureIndicatingAjaxButton( GlobalIds.SEARCH, GlobalIds.DEL_REVIEW_MGR, "searchOU" )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
- protected void onSubmit( AjaxRequestTarget target, Form form )
+ protected void onSubmit(AjaxRequestTarget target, Form form)
{
log.debug( ".search onSubmit" );
info( "Searching OrgUnits..." );
@@ -197,7 +196,7 @@ public class OUListPanel extends FormComponentPanel
@Override
- public void onError( AjaxRequestTarget target, Form form )
+ public void onError(AjaxRequestTarget target, Form form)
{
log.warn( ".search.onError" );
target.add();
@@ -205,7 +204,7 @@ public class OUListPanel extends FormComponentPanel
@Override
- protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes( attributes );
AjaxCallListener ajaxCallListener = new AjaxCallListener()
@@ -215,7 +214,7 @@ public class OUListPanel extends FormComponentPanel
@Override
- public CharSequence getFailureHandler( Component component )
+ public CharSequence getFailureHandler(Component component)
{
return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
}
@@ -223,7 +222,7 @@ public class OUListPanel extends FormComponentPanel
attributes.getAjaxCallListeners().add( ajaxCallListener );
}
} );
- add( this.listForm );
+ add( listForm );
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
index e7f4bbf..210a179 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/OUSearchModalPanel.java
@@ -38,7 +38,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.SecUtils;
+import org.apache.directory.fortress.web.control.SecUtils;
import org.apache.directory.fortress.core.DelReviewMgr;
import org.apache.directory.fortress.core.rbac.OrgUnit;
@@ -85,7 +85,7 @@ public class OUSearchModalPanel extends Panel
private PageableListView createListView( final LoadableDetachableModel requests )
{
- final PageableListView listView = new PageableListView( "dataview", requests, 16 )
+ return new PageableListView( "dataview", requests, 16 )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -111,13 +111,12 @@ public class OUSearchModalPanel extends Panel
item.add( new Label( "description", new PropertyModel( item.getModel(), "description" ) ) );
}
};
- return listView;
}
private LoadableDetachableModel getListViewModel()
{
- final LoadableDetachableModel ret = new LoadableDetachableModel()
+ return new LoadableDetachableModel()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -158,7 +157,6 @@ public class OUSearchModalPanel extends Panel
return ous;
}
};
- return ret;
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/ObjectDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/ObjectDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/ObjectDetailPanel.java
index 0a41354..1fac856 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/ObjectDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/ObjectDetailPanel.java
@@ -37,11 +37,11 @@ import org.apache.wicket.markup.html.form.TextField;
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.SecUtils;
-import org.apache.directory.fortress.web.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.rbac.OrgUnit;
import org.apache.directory.fortress.core.rbac.PermObj;
@@ -62,7 +62,6 @@ public class ObjectDetailPanel extends FormComponentPanel
private Form editForm;
private Displayable display;
private boolean isAdmin;
- private String objName;
private TextField objNameTF;
private SecureIndicatingAjaxButton addPB;
@@ -77,6 +76,7 @@ public class ObjectDetailPanel extends FormComponentPanel
{
super( id );
this.isAdmin = isAdmin;
+ String objName;
if ( isAdmin )
objName = GlobalIds.DEL_ADMIN_MGR;
else
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/ObjectListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/ObjectListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/ObjectListPanel.java
index 606040f..b20eb3f 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/ObjectListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/ObjectListPanel.java
@@ -38,13 +38,13 @@ import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.ObjectListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.model.ObjectListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+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.FortEntity;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
@@ -80,13 +80,12 @@ public class ObjectListPanel extends FormComponentPanel
private char selectedRadioButton;
private static final char NAMES = 'N';
private static final char OUS = 'O';
- private boolean isAdmin;
public ObjectListPanel( String id, final boolean isAdmin )
{
super( id );
- this.isAdmin = isAdmin;
+ boolean isAdmin1 = isAdmin;
ObjectListModel objectListModel = new ObjectListModel( new PermObj( "" ), isAdmin,
SecUtils.getSession( this ) );
setDefaultModel( objectListModel );
@@ -314,7 +313,7 @@ public class ObjectListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
this.listForm = new Form( "objectlistform" );
this.listForm.add( grid );
add( this.listForm );
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
index 93b9fa9..da93d10 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/ObjectSearchModalPanel.java
@@ -38,7 +38,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.SecUtils;
+import org.apache.directory.fortress.web.control.SecUtils;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.rbac.PermObj;
@@ -84,7 +84,7 @@ public class ObjectSearchModalPanel extends Panel
private PageableListView createListView( final LoadableDetachableModel requests )
{
- final PageableListView listView = new PageableListView( "dataview", requests, 16 )
+ return new PageableListView( "dataview", requests, 16 )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -112,7 +112,6 @@ public class ObjectSearchModalPanel extends Panel
item.add( new Label( "type", new PropertyModel( item.getModel(), "type" ) ) );
}
};
- return listView;
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/PermDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PermDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PermDetailPanel.java
index 6c34bbb..5fdc4cf 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PermDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PermDetailPanel.java
@@ -39,11 +39,11 @@ 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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.DelAdminMgr;
import org.apache.directory.fortress.core.rbac.AdminRole;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/PermListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PermListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PermListPanel.java
index c899653..9931ea9 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PermListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PermListPanel.java
@@ -36,13 +36,13 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.PermListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.model.PermListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+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.FortEntity;
import org.apache.directory.fortress.core.rbac.PermObj;
import org.apache.directory.fortress.core.rbac.Permission;
@@ -152,7 +152,7 @@ public class PermListPanel extends FormComponentPanel
grid.setClickRowToDeselect( false );
grid.setSelectToEdit( false );
// expand the root node
- grid.getTreeState().expandAll();;
+ grid.getTreeState().expandAll();
listForm = new Form( "form" );
listForm.add( grid );
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/PermSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
index 000fd10..1e63c44 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PermSearchModalPanel.java
@@ -38,7 +38,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.SecUtils;
+import org.apache.directory.fortress.web.control.SecUtils;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.rbac.Permission;
@@ -86,7 +86,7 @@ public class PermSearchModalPanel extends Panel
private PageableListView createListView( final LoadableDetachableModel requests )
{
- final PageableListView listView = new PageableListView( "dataview", requests, 16 )
+ return new PageableListView( "dataview", requests, 16 )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -115,13 +115,12 @@ public class PermSearchModalPanel extends Panel
item.add( new Label( "admin", new PropertyModel( item.getModel(), "admin" ) ) );
}
};
- return listView;
}
private LoadableDetachableModel getListViewModel()
{
- final LoadableDetachableModel ret = new LoadableDetachableModel()
+ return new LoadableDetachableModel()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -161,7 +160,6 @@ public class PermSearchModalPanel extends Panel
return objects;
}
};
- return ret;
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyDetailPanel.java
index 867f330..63b1596 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyDetailPanel.java
@@ -37,11 +37,11 @@ import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.validation.validator.RangeValidator;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.PwPolicyMgr;
import org.apache.directory.fortress.core.rbac.PwPolicy;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyListPanel.java
index 48db1c5..990d46d 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicyListPanel.java
@@ -35,11 +35,11 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.PwPolicyListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.model.PwPolicyListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.rbac.FortEntity;
import org.apache.directory.fortress.core.rbac.PwPolicy;
import org.apache.wicket.markup.html.form.Form;
@@ -62,7 +62,6 @@ public class PwPolicyListPanel extends FormComponentPanel
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger( PwPolicyListPanel.class.getName() );
- private Form listForm;
private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
@@ -189,21 +188,21 @@ public class PwPolicyListPanel extends FormComponentPanel
grid.setSelectToEdit( false );
// expand the root node
grid.getTreeState().expandAll();;
- this.listForm = new Form( "form" );
- this.listForm.add( grid );
+ Form listForm = new Form( "form" );
+ listForm.add( grid );
grid.setOutputMarkupId( true );
TextField searchValFld = new TextField( GlobalIds.SEARCH_VAL, new PropertyModel<String>( this,
GlobalIds.SEARCH_VAL ) );
- this.listForm.add( searchValFld );
+ listForm.add( searchValFld );
- this.listForm.add( new AjaxSubmitLink( GlobalIds.SEARCH )
+ listForm.add( new AjaxSubmitLink( GlobalIds.SEARCH )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
- protected void onSubmit( AjaxRequestTarget target, Form form )
+ protected void onSubmit(AjaxRequestTarget target, Form form)
{
log.debug( ".search onSubmit" );
info( "Searching Policies..." );
@@ -231,7 +230,7 @@ public class PwPolicyListPanel extends FormComponentPanel
@Override
- public void onError( AjaxRequestTarget target, Form form )
+ public void onError(AjaxRequestTarget target, Form form)
{
log.warn( ".search.onError" );
target.add();
@@ -239,7 +238,7 @@ public class PwPolicyListPanel extends FormComponentPanel
@Override
- protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes( attributes );
AjaxCallListener ajaxCallListener = new AjaxCallListener()
@@ -249,7 +248,7 @@ public class PwPolicyListPanel extends FormComponentPanel
@Override
- public CharSequence getFailureHandler( Component component )
+ public CharSequence getFailureHandler(Component component)
{
return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
}
@@ -257,7 +256,7 @@ public class PwPolicyListPanel extends FormComponentPanel
attributes.getAjaxCallListeners().add( ajaxCallListener );
}
} );
- add( this.listForm );
+ add( listForm );
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
index d53233e..b00d7e1 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/PwPolicySearchModalPanel.java
@@ -83,7 +83,7 @@ public class PwPolicySearchModalPanel extends Panel
private PageableListView createListView( final LoadableDetachableModel requests )
{
- final PageableListView listView = new PageableListView( "policydataview", requests, 16 )
+ return new PageableListView( "policydataview", requests, 16 )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -124,13 +124,12 @@ public class PwPolicySearchModalPanel extends Panel
}
};
- return listView;
}
private LoadableDetachableModel getListViewModel()
{
- final LoadableDetachableModel ret = new LoadableDetachableModel()
+ return new LoadableDetachableModel()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -167,7 +166,6 @@ public class PwPolicySearchModalPanel extends Panel
return policies;
}
};
- return ret;
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/RoleAdminDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/RoleAdminDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/RoleAdminDetailPanel.java
index 04b98bc..69bffc7 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/RoleAdminDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/RoleAdminDetailPanel.java
@@ -35,7 +35,7 @@ import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.directory.fortress.core.rbac.AdminRole;
import org.apache.directory.fortress.core.rbac.OrgUnit;
import org.apache.directory.fortress.core.rbac.UserRole;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java
index a5418d4..3505812 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java
@@ -41,11 +41,11 @@ 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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.DelAdminMgr;
import org.apache.directory.fortress.core.rbac.AdminRole;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/RoleListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/RoleListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/RoleListPanel.java
index c6f4f7a..5b5fca3 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/RoleListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/RoleListPanel.java
@@ -34,12 +34,12 @@ import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.RoleListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.model.RoleListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.rbac.AdminRole;
import org.apache.directory.fortress.core.rbac.FortEntity;
import org.apache.directory.fortress.core.rbac.Role;
@@ -65,7 +65,6 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger( RoleListPanel.class.getName() );
- private Form listForm;
private DefaultTreeModel treeModel;
private DefaultMutableTreeNode node;
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
@@ -165,21 +164,21 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
grid.setSelectToEdit( false );
// expand the root node
grid.getTreeState().expandAll();;
- this.listForm = new Form( "form" );
- this.listForm.add( grid );
+ Form listForm = new Form( "form" );
+ listForm.add( grid );
grid.setOutputMarkupId( true );
TextField searchValFld = new TextField( GlobalIds.SEARCH_VAL, new PropertyModel<String>( this,
GlobalIds.SEARCH_VAL ) );
- this.listForm.add( searchValFld );
+ listForm.add( searchValFld );
- this.listForm.add( new SecureIndicatingAjaxButton( GlobalIds.SEARCH, GlobalIds.REVIEW_MGR, "findRoles" )
+ listForm.add( new SecureIndicatingAjaxButton( GlobalIds.SEARCH, GlobalIds.REVIEW_MGR, "findRoles" )
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
- protected void onSubmit( AjaxRequestTarget target, Form form )
+ protected void onSubmit(AjaxRequestTarget target, Form form)
{
log.debug( ".search onSubmit" );
info( "Searching Roles..." );
@@ -208,7 +207,7 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
@Override
- public void onError( AjaxRequestTarget target, Form form )
+ public void onError(AjaxRequestTarget target, Form form)
{
log.warn( ".search.onError" );
target.add();
@@ -216,7 +215,7 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
@Override
- protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes( attributes );
AjaxCallListener ajaxCallListener = new AjaxCallListener()
@@ -226,7 +225,7 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
@Override
- public CharSequence getFailureHandler( Component component )
+ public CharSequence getFailureHandler(Component component)
{
return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
}
@@ -234,7 +233,7 @@ public class RoleListPanel<T extends Serializable> extends FormComponentPanel
attributes.getAjaxCallListeners().add( ajaxCallListener );
}
} );
- add( this.listForm );
+ add( listForm );
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
index 045b217..e8eeb68 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/RoleSearchModalPanel.java
@@ -39,7 +39,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.SecUtils;
+import org.apache.directory.fortress.web.control.SecUtils;
import org.apache.directory.fortress.core.DelReviewMgr;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.rbac.Role;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/SDDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/SDDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/SDDetailPanel.java
index da46990..8489311 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/SDDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/SDDetailPanel.java
@@ -40,11 +40,11 @@ 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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.rbac.SDSet;
import org.apache.directory.fortress.core.rbac.UserRole;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/SDListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/SDListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/SDListPanel.java
index cfae5c1..d3e1e5d 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/SDListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/SDListPanel.java
@@ -38,13 +38,13 @@ import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SDListModel;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.model.SDListModel;
+import org.apache.directory.fortress.web.event.SaveModelEvent;
+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.FortEntity;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
@@ -75,8 +75,6 @@ public class SDListPanel extends FormComponentPanel
private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
private DefaultMutableTreeNode rootNode;
private String searchVal;
- private String searchLabel;
- private String opName;
private char selectedRadioButton;
private TextField searchValFld;
private RadioGroup radioGroup;
@@ -89,6 +87,8 @@ public class SDListPanel extends FormComponentPanel
super( id );
SDSet sdSet = new SDSet();
sdSet.setName( "" );
+ String searchLabel;
+ String opName;
if ( isStatic )
{
sdSet.setType( SDSet.SDType.STATIC );
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/UserAuditDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserAuditDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/UserAuditDetailPanel.java
index 47d40c6..fef5fa4 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserAuditDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserAuditDetailPanel.java
@@ -25,7 +25,7 @@ import org.apache.log4j.Logger;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.model.IModel;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
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/UserDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/UserDetailPanel.java
index 758ec37..6057494 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserDetailPanel.java
@@ -47,11 +47,11 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
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.SaveModelEvent;
-import org.apache.directory.fortress.web.SecureIndicatingAjaxButton;
-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.SaveModelEvent;
+import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.DelAdminMgr;
import org.apache.directory.fortress.core.rbac.OrgUnit;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
index 82d0afe..89b9166 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
@@ -24,6 +24,13 @@ package org.apache.directory.fortress.web.panel;
import com.inmethod.grid.IGridColumn;
import com.inmethod.grid.column.PropertyColumn;
import com.inmethod.grid.treegrid.TreeGrid;
+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.SaveModelEvent;
+import org.apache.directory.fortress.web.event.SelectModelEvent;
+import org.apache.directory.fortress.web.model.UserListModel;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -44,13 +51,6 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
-import org.apache.directory.fortress.web.GlobalIds;
-import org.apache.directory.fortress.web.SecUtils;
-import org.apache.directory.fortress.web.SaveModelEvent;
-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.UserListModel;
import org.apache.directory.fortress.web.UserPage;
import org.apache.directory.fortress.core.rbac.FortEntity;
import org.apache.directory.fortress.core.rbac.OrgUnit;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
index 0a52570..179b717 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserSearchModalPanel.java
@@ -38,8 +38,8 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
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.common.GlobalIds;
+import org.apache.directory.fortress.web.control.SecUtils;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.rbac.User;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java b/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
index 848c263..2ceef25 100644
--- a/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
+++ b/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
@@ -32,7 +32,7 @@ import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.LocalFileDetector;
-import org.apache.directory.fortress.web.GlobalIds;
+import org.apache.directory.fortress.web.common.GlobalIds;
/**
* This class uses apache selenium firefox driver to drive commander web ui
@@ -625,18 +625,18 @@ TODO: FIX ME:
// And iterate over them, getting the cells
allRows.get( 5 ).findElement(By.className("imxt-cell")).click();
TUtils.sleep( 1 );
- nextPage(table, "modstable");
+ nextPage( "modstable");
TUtils.sleep( 1 );
allRows.get( 6 ).findElement(By.className("imxt-cell")).click();
TUtils.sleep( 1 );
- nextPage(table, "modstable");
+ nextPage( "modstable");
TUtils.sleep( 1 );
}
- private void nextPage(WebElement table, String szTableName)
+ private void nextPage(String szTableName)
{
- table = driver.findElement(By.id( szTableName));
- List<WebElement> allRows = table.findElements(By.tagName("a"));
+ WebElement table = driver.findElement( By.id( szTableName ) );
+ List<WebElement> allRows = table.findElements( By.tagName( "a" ) );
for (WebElement row : allRows)
{
String szText = row.getText();
[5/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
Posted by sm...@apache.org.
FC-105 - remove cycles and fix other findbugs issues
Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/commit/fe719b1b
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/tree/fe719b1b
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/diff/fe719b1b
Branch: refs/heads/master
Commit: fe719b1bb472a7c5e162dacf3bb3ef2a36177536
Parents: e387f6c
Author: Shawn McKinney <sm...@apache.org>
Authored: Thu May 28 19:19:19 2015 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Thu May 28 19:19:19 2015 -0500
----------------------------------------------------------------------
.../directory/fortress/web/AjaxUpdateEvent.java | 43 --
.../fortress/web/ApplicationContext.java | 1 +
.../fortress/web/AuditAuthzListModel.java | 190 ---------
.../directory/fortress/web/AuditAuthzPage.java | 3 +-
.../fortress/web/AuditBindListModel.java | 143 -------
.../directory/fortress/web/AuditBindPage.java | 3 +-
.../fortress/web/AuditModListModel.java | 205 ----------
.../directory/fortress/web/AuditModPage.java | 3 +-
.../directory/fortress/web/AuditUtils.java | 201 ---------
.../fortress/web/FortressWebBasePage.java | 68 ++--
.../fortress/web/FtBookmarkablePageLink.java | 56 ---
.../fortress/web/FtIndicatingAjaxButton.java | 105 -----
.../directory/fortress/web/GlobalIds.java | 231 -----------
.../directory/fortress/web/GroupListModel.java | 167 --------
.../directory/fortress/web/GroupPage.java | 3 +-
.../directory/fortress/web/OUListModel.java | 154 -------
.../directory/fortress/web/ObjectAdminPage.java | 3 +-
.../directory/fortress/web/ObjectListModel.java | 171 --------
.../directory/fortress/web/ObjectPage.java | 3 +-
.../directory/fortress/web/OuPermPage.java | 3 +-
.../directory/fortress/web/OuUserPage.java | 3 +-
.../directory/fortress/web/PermAdminPage.java | 3 +-
.../directory/fortress/web/PermListModel.java | 159 --------
.../apache/directory/fortress/web/PermPage.java | 3 +-
.../fortress/web/PwPolicyListModel.java | 152 -------
.../directory/fortress/web/PwPolicyPage.java | 1 +
.../directory/fortress/web/RoleAdminPage.java | 3 +-
.../directory/fortress/web/RoleListModel.java | 193 ---------
.../apache/directory/fortress/web/RolePage.java | 3 +-
.../directory/fortress/web/SDListModel.java | 183 ---------
.../directory/fortress/web/SaveModelEvent.java | 235 -----------
.../directory/fortress/web/SdDynamicPage.java | 4 +-
.../directory/fortress/web/SdStaticPage.java | 3 +-
.../apache/directory/fortress/web/SecUtils.java | 403 -------------------
.../web/SecureBookmarkablePageLink.java | 78 ----
.../web/SecureIndicatingAjaxButton.java | 143 -------
.../fortress/web/SecureIndicatingAjaxLink.java | 53 ---
.../fortress/web/SelectModelEvent.java | 196 ---------
.../fortress/web/SerializableList.java | 180 ---------
.../directory/fortress/web/UserListModel.java | 203 ----------
.../apache/directory/fortress/web/UserPage.java | 1 +
.../directory/fortress/web/WicketSession.java | 80 ----
.../fortress/web/common/GlobalIds.java | 231 +++++++++++
.../web/control/FtBookmarkablePageLink.java | 56 +++
.../web/control/FtIndicatingAjaxButton.java | 105 +++++
.../fortress/web/control/SecUtils.java | 403 +++++++++++++++++++
.../web/control/SecureBookmarkablePageLink.java | 78 ++++
.../web/control/SecureIndicatingAjaxButton.java | 143 +++++++
.../web/control/SecureIndicatingAjaxLink.java | 53 +++
.../fortress/web/control/WicketSession.java | 80 ++++
.../fortress/web/event/AjaxUpdateEvent.java | 43 ++
.../fortress/web/event/SaveModelEvent.java | 235 +++++++++++
.../fortress/web/event/SelectModelEvent.java | 196 +++++++++
.../fortress/web/model/AuditAuthzListModel.java | 190 +++++++++
.../fortress/web/model/AuditBindListModel.java | 143 +++++++
.../fortress/web/model/AuditModListModel.java | 205 ++++++++++
.../fortress/web/model/GroupListModel.java | 167 ++++++++
.../fortress/web/model/OUListModel.java | 154 +++++++
.../fortress/web/model/ObjectListModel.java | 171 ++++++++
.../fortress/web/model/PermListModel.java | 159 ++++++++
.../fortress/web/model/PwPolicyListModel.java | 152 +++++++
.../fortress/web/model/RoleListModel.java | 193 +++++++++
.../fortress/web/model/SDListModel.java | 183 +++++++++
.../fortress/web/model/SerializableList.java | 180 +++++++++
.../fortress/web/model/UserListModel.java | 203 ++++++++++
.../web/panel/AuditAuthzDetailPanel.java | 7 +-
.../fortress/web/panel/AuditAuthzListPanel.java | 18 +-
.../web/panel/AuditBindDetailPanel.java | 7 +-
.../fortress/web/panel/AuditBindListPanel.java | 23 +-
.../fortress/web/panel/AuditModDetailPanel.java | 7 +-
.../fortress/web/panel/AuditModListPanel.java | 22 +-
.../fortress/web/panel/AuditUtils.java | 206 ++++++++++
.../web/panel/ConstraintAdminRolePanel.java | 2 +-
.../fortress/web/panel/GroupDetailPanel.java | 10 +-
.../fortress/web/panel/GroupListPanel.java | 16 +-
.../directory/fortress/web/panel/NavPanel.java | 4 +-
.../fortress/web/panel/OUDetailPanel.java | 10 +-
.../fortress/web/panel/OUListPanel.java | 35 +-
.../fortress/web/panel/OUSearchModalPanel.java | 8 +-
.../fortress/web/panel/ObjectDetailPanel.java | 12 +-
.../fortress/web/panel/ObjectListPanel.java | 19 +-
.../web/panel/ObjectSearchModalPanel.java | 5 +-
.../fortress/web/panel/PermDetailPanel.java | 10 +-
.../fortress/web/panel/PermListPanel.java | 16 +-
.../web/panel/PermSearchModalPanel.java | 8 +-
.../fortress/web/panel/PwPolicyDetailPanel.java | 10 +-
.../fortress/web/panel/PwPolicyListPanel.java | 29 +-
.../web/panel/PwPolicySearchModalPanel.java | 6 +-
.../web/panel/RoleAdminDetailPanel.java | 2 +-
.../fortress/web/panel/RoleDetailPanel.java | 10 +-
.../fortress/web/panel/RoleListPanel.java | 31 +-
.../web/panel/RoleSearchModalPanel.java | 2 +-
.../fortress/web/panel/SDDetailPanel.java | 10 +-
.../fortress/web/panel/SDListPanel.java | 18 +-
.../web/panel/UserAuditDetailPanel.java | 2 +-
.../fortress/web/panel/UserDetailPanel.java | 10 +-
.../fortress/web/panel/UserListPanel.java | 14 +-
.../web/panel/UserSearchModalPanel.java | 4 +-
.../integration/FortressWebSeleniumITCase.java | 12 +-
99 files changed, 4186 insertions(+), 4180 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/AjaxUpdateEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AjaxUpdateEvent.java b/src/main/java/org/apache/directory/fortress/web/AjaxUpdateEvent.java
deleted file mode 100644
index 0ee6298..0000000
--- a/src/main/java/org/apache/directory/fortress/web/AjaxUpdateEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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;
-
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class AjaxUpdateEvent
-{
-
- private final AjaxRequestTarget target;
-
- public AjaxUpdateEvent(AjaxRequestTarget target)
- {
- this.target = target;
- }
-
- public AjaxRequestTarget getAjaxRequestTarget()
- {
- return target;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/ApplicationContext.java b/src/main/java/org/apache/directory/fortress/web/ApplicationContext.java
index 44dce06..1746c11 100644
--- a/src/main/java/org/apache/directory/fortress/web/ApplicationContext.java
+++ b/src/main/java/org/apache/directory/fortress/web/ApplicationContext.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.control.WicketSession;
import org.apache.wicket.Page;
import org.apache.wicket.Session;
import org.apache.wicket.core.request.handler.PageProvider;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/AuditAuthzListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditAuthzListModel.java b/src/main/java/org/apache/directory/fortress/web/AuditAuthzListModel.java
deleted file mode 100644
index 3dbb96f..0000000
--- a/src/main/java/org/apache/directory/fortress/web/AuditAuthzListModel.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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;
-
-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/AuditAuthzPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditAuthzPage.java b/src/main/java/org/apache/directory/fortress/web/AuditAuthzPage.java
index 009d4b3..d7dbd53 100644
--- a/src/main/java/org/apache/directory/fortress/web/AuditAuthzPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/AuditAuthzPage.java
@@ -19,6 +19,7 @@
*/
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -57,7 +58,7 @@ public class AuditAuthzPage extends FortressWebBasePage
private void init(final UserAudit userAudit)
{
add(new Label("pageHeader", "Audit Authorization Viewer"));
- WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT);
FourWaySplitter splitter = new FourWaySplitter("60", "40");
splitter.addBorderLayout(container);
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/AuditBindListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditBindListModel.java b/src/main/java/org/apache/directory/fortress/web/AuditBindListModel.java
deleted file mode 100644
index 43969de..0000000
--- a/src/main/java/org/apache/directory/fortress/web/AuditBindListModel.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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;
-
-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/AuditBindPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditBindPage.java b/src/main/java/org/apache/directory/fortress/web/AuditBindPage.java
index 453fe80..9ae008d 100644
--- a/src/main/java/org/apache/directory/fortress/web/AuditBindPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/AuditBindPage.java
@@ -19,6 +19,7 @@
*/
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -56,7 +57,7 @@ public class AuditBindPage extends FortressWebBasePage
private void init(final UserAudit userAudit)
{
- add(new Label(GlobalIds.PAGE_HEADER, "Audit Bind Viewer"));
+ add(new Label( GlobalIds.PAGE_HEADER, "Audit Bind Viewer"));
WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
FourWaySplitter splitter = new FourWaySplitter("60", "40");
splitter.addBorderLayout(container);
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/AuditModListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditModListModel.java b/src/main/java/org/apache/directory/fortress/web/AuditModListModel.java
deleted file mode 100644
index f9df463..0000000
--- a/src/main/java/org/apache/directory/fortress/web/AuditModListModel.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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;
-
-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/AuditModPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditModPage.java b/src/main/java/org/apache/directory/fortress/web/AuditModPage.java
index caaecd8..8520f52 100644
--- a/src/main/java/org/apache/directory/fortress/web/AuditModPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/AuditModPage.java
@@ -19,6 +19,7 @@
*/
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -56,7 +57,7 @@ public class AuditModPage extends FortressWebBasePage
private void init(final UserAudit userAudit)
{
- add(new Label(GlobalIds.PAGE_HEADER, "Audit Modification Viewer"));
+ add(new Label( GlobalIds.PAGE_HEADER, "Audit Modification Viewer"));
WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
FourWaySplitter splitter = new FourWaySplitter("55", "45");
splitter.addBorderLayout(container);
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/AuditUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/AuditUtils.java b/src/main/java/org/apache/directory/fortress/web/AuditUtils.java
deleted file mode 100644
index 7ee40f1..0000000
--- a/src/main/java/org/apache/directory/fortress/web/AuditUtils.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.apache.directory.fortress.web;
-
-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.User;
-import org.apache.directory.fortress.core.util.attr.VUtil;
-import org.apache.log4j.Logger;
-
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * Created by smckinn on 3/10/15.
- */
-public class AuditUtils
-{
- private static final Logger LOG = Logger.getLogger( AuditUtils.class.getName() );
- /**
- *
- * @param raw
- * @return
- */
- public static Permission getAuthZPerm( String raw )
- {
- //// ftOpNm=addUser,ftObjNm=org.apache.directory.fortress.core.rbac.AdminMgrImpl,ou=AdminPerms,ou=ARBAC,dc=jts,dc=us
- // ftObjId=006+ftOpNm=TOP1_6,ftObjNm=TOB1_4,ou=Permissions,ou=RBAC,dc=jts,dc=us
-
- // TODO: use fortress GlobalIds instead:
- final String OBJ_ID = "ftObjId";
- final String OBJ_NM = "ftObjNm";
- final String OP_NM = "ftOpNm";
- Permission perm = new Permission();
- int bindx = raw.indexOf( OBJ_ID );
- if ( bindx != -1 )
- {
- int eindx = raw.indexOf( "+" );
- if ( eindx != -1 )
- {
- perm.setObjId( raw.substring( bindx + OBJ_ID.length() + 1, eindx ) );
- }
- }
- bindx = raw.indexOf( OBJ_NM );
- if ( bindx != -1 )
- {
- int eindx = raw.substring( bindx ).indexOf( "," );
- if ( eindx != -1 )
- {
- eindx += bindx;
- perm.setObjName( raw.substring( bindx + OBJ_NM.length() + 1, eindx ) );
- }
- }
- bindx = raw.indexOf( OP_NM );
- if ( bindx != -1 )
- {
- int eindx = raw.substring( bindx ).indexOf( "," );
- if ( eindx != -1 )
- {
- eindx += bindx;
- perm.setOpName( raw.substring( bindx + OP_NM.length() + 1, eindx ) );
- }
- }
- return perm;
- }
-
- /**
- *
- * @param authZ
- */
- public static void mapAuthZPerm( AuthZ authZ )
- {
- //// ftOpNm=addUser,ftObjNm=org.apache.directory.fortress.core.rbac.AdminMgrImpl,ou=AdminPerms,ou=ARBAC,dc=jts,dc=us
- // ftObjId=006+ftOpNm=TOP1_6,ftObjNm=TOB1_4,ou=Permissions,ou=RBAC,dc=jts,dc=us
- String raw = authZ.getReqDN();
-
- // TODO: use fortress GlobalIds instead:
- final String OBJ_ID = "ftObjId";
- final String OBJ_NM = "ftObjNm";
- final String OP_NM = "ftOpNm";
-
- // TODO: fix this mapping:
- //reqDerefAliases
- //reqAttr
- //reqAttrsOnly
-
- //Permission perm = new Permission();
- int bindx = raw.indexOf( OBJ_ID );
- if ( bindx != -1 )
- {
- int eindx = raw.indexOf( "+" );
- if ( eindx != -1 )
- {
- authZ.setReqDerefAliases( raw.substring( bindx + OBJ_ID.length() + 1, eindx ) );
- }
- }
- bindx = raw.indexOf( OBJ_NM );
- if ( bindx != -1 )
- {
- int eindx = raw.substring( bindx ).indexOf( "," );
- if ( eindx != -1 )
- {
- eindx += bindx;
- authZ.setReqAttr( raw.substring( bindx + OBJ_NM.length() + 1, eindx ) );
- }
- }
- bindx = raw.indexOf( OP_NM );
- if ( bindx != -1 )
- {
- int eindx = raw.substring( bindx ).indexOf( "," );
- if ( eindx != -1 )
- {
- eindx += bindx;
- authZ.setReqAttrsOnly( raw.substring( bindx + OP_NM.length() + 1, eindx ) );
- }
- }
- }
-
- /**
- *
- * @param inputString
- * @return
- */
- public static String getAuthZId( String inputString )
- {
- //reqAuthzID: uid=fttu3user4,ou=people,dc=jts,dc=com
- String userId = null;
- if ( inputString != null && inputString.length() > 0 )
- {
- StringTokenizer maxTkn = new StringTokenizer( inputString, "," );
- if ( maxTkn.countTokens() > 0 )
- {
- String val = maxTkn.nextToken();
- int indx = val.indexOf( '=' );
- if ( indx >= 1 )
- {
- userId = val.substring( indx + 1 );
- }
- }
- }
- return userId;
- }
-
- /**
- *
- * @param reviewMgr
- * @param userId
- * @return
- */
- public static User getUser( ReviewMgr reviewMgr, String userId )
- {
- User user = null;
- try
- {
- user = reviewMgr.readUser( new User( userId ) );
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String error = "SecurityException=" + se;
- LOG.warn( error );
-
- }
- return user;
- }
-
- /**
- *
- * @param reviewMgr
- * @param internalId
- * @return
- */
- public static User getUserByInternalId( ReviewMgr reviewMgr, String internalId )
- {
- User user = null;
- try
- {
- User inUser = new User();
- inUser.setInternalId( internalId );
- List<User> users = reviewMgr.findUsers( inUser );
- if ( VUtil.isNotNullOrEmpty( users ) )
- {
- if ( users.size() > 1 )
- {
- String error = "Found: " + users.size() + " users matching internalId: " + internalId;
- LOG.warn( error );
- }
- user = users.get( 0 );
- }
- else
- {
- String error = "Can't find user matching internalId: " + internalId;
- LOG.warn( error );
- }
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String error = "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/FortressWebBasePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
index 0d76db1..bcfc72f 100644
--- a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
+++ b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
@@ -22,6 +22,9 @@ package org.apache.directory.fortress.web;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.realm.J2eePolicyMgr;
+import org.apache.directory.fortress.web.control.SecUtils;
+import org.apache.directory.fortress.web.control.SecureBookmarkablePageLink;
+import org.apache.directory.fortress.web.control.WicketSession;
import org.apache.log4j.Logger;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
@@ -57,74 +60,75 @@ public abstract class FortressWebBasePage extends WebPage
public FortressWebBasePage()
{
- SecureBookmarkablePageLink usersLink = new SecureBookmarkablePageLink( GlobalIds.USERS_PAGE, UserPage.class,
- GlobalIds.ROLE_USERS );
+ SecureBookmarkablePageLink usersLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web
+ .common.GlobalIds.USERS_PAGE, UserPage.class,
+ org.apache.directory.fortress.web.common.GlobalIds.ROLE_USERS );
add( usersLink );
PageParameters parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.RBAC_TYPE );
- SecureBookmarkablePageLink rolesLink = new SecureBookmarkablePageLink( GlobalIds.ROLES_PAGE, RolePage.class,
- parameters, GlobalIds.ROLE_ROLES );
+ SecureBookmarkablePageLink rolesLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.ROLES_PAGE, RolePage.class,
+ parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_ROLES );
add( rolesLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.ADMIN_TYPE );
- SecureBookmarkablePageLink admrolesLink = new SecureBookmarkablePageLink( GlobalIds.ADMROLES_PAGE,
- RoleAdminPage.class, parameters, GlobalIds.ROLE_ADMINROLES );
+ SecureBookmarkablePageLink admrolesLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.ADMROLES_PAGE,
+ RoleAdminPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_ADMINROLES );
add( admrolesLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.RBAC_TYPE );
- SecureBookmarkablePageLink objectsLink = new SecureBookmarkablePageLink( GlobalIds.POBJS_PAGE,
- ObjectPage.class, parameters, GlobalIds.ROLE_PERMOBJS );
+ SecureBookmarkablePageLink objectsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.POBJS_PAGE,
+ ObjectPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_PERMOBJS );
add( objectsLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.ADMIN_TYPE );
- SecureBookmarkablePageLink admobjsLink = new SecureBookmarkablePageLink( GlobalIds.ADMPOBJS_PAGE,
- ObjectAdminPage.class, parameters, GlobalIds.ROLE_ADMINOBJS );
+ SecureBookmarkablePageLink admobjsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.ADMPOBJS_PAGE,
+ ObjectAdminPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_ADMINOBJS );
add( admobjsLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.RBAC_TYPE );
- SecureBookmarkablePageLink permsLink = new SecureBookmarkablePageLink( GlobalIds.PERMS_PAGE, PermPage.class,
- parameters, GlobalIds.ROLE_PERMS );
+ SecureBookmarkablePageLink permsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.PERMS_PAGE, PermPage.class,
+ parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_PERMS );
add( permsLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.ADMIN_TYPE );
- SecureBookmarkablePageLink admpermsLink = new SecureBookmarkablePageLink( GlobalIds.ADMPERMS_PAGE,
- PermAdminPage.class, parameters, GlobalIds.ROLE_ADMINPERMS );
+ SecureBookmarkablePageLink admpermsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.ADMPERMS_PAGE,
+ PermAdminPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_ADMINPERMS );
add( admpermsLink );
- SecureBookmarkablePageLink policiesLink = new SecureBookmarkablePageLink( GlobalIds.PWPOLICIES_PAGE,
- PwPolicyPage.class, GlobalIds.ROLE_POLICIES );
+ SecureBookmarkablePageLink policiesLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.PWPOLICIES_PAGE,
+ PwPolicyPage.class, org.apache.directory.fortress.web.common.GlobalIds.ROLE_POLICIES );
add( policiesLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.SSD );
- SecureBookmarkablePageLink ssdsLink = new SecureBookmarkablePageLink( GlobalIds.SSDS_PAGE,
- SdStaticPage.class, parameters, GlobalIds.ROLE_SSDS );
+ SecureBookmarkablePageLink ssdsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.SSDS_PAGE,
+ SdStaticPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_SSDS );
add( ssdsLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.DSD );
- SecureBookmarkablePageLink dsdsLink = new SecureBookmarkablePageLink( GlobalIds.DSDS_PAGE,
- SdDynamicPage.class, parameters, GlobalIds.ROLE_DSDS );
+ SecureBookmarkablePageLink dsdsLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.DSDS_PAGE,
+ SdDynamicPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_DSDS );
add( dsdsLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, GlobalIds.USEROUS );
- SecureBookmarkablePageLink userouLink = new SecureBookmarkablePageLink( GlobalIds.USEROUS_PAGE,
- OuUserPage.class, parameters, GlobalIds.ROLE_USEROUS );
+ SecureBookmarkablePageLink userouLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.USEROUS_PAGE,
+ OuUserPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_USEROUS );
add( userouLink );
parameters = new PageParameters();
//parameters.set( GlobalIds.PAGE_TYPE, "PERMOUS" );
- SecureBookmarkablePageLink permouLink = new SecureBookmarkablePageLink( GlobalIds.PERMOUS_PAGE,
- OuPermPage.class, parameters, GlobalIds.ROLE_PERMOUS );
+ SecureBookmarkablePageLink permouLink = new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.PERMOUS_PAGE,
+ OuPermPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_PERMOUS );
add( permouLink );
- add( new SecureBookmarkablePageLink( GlobalIds.GROUP_PAGE, GroupPage.class,
- GlobalIds.ROLE_GROUPS ) );
+ add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.GROUP_PAGE, GroupPage.class,
+ org.apache.directory.fortress.web.common.GlobalIds.ROLE_GROUPS ) );
- add( new SecureBookmarkablePageLink( GlobalIds.AUDIT_BINDS_PAGE, AuditBindPage.class,
- GlobalIds.ROLE_AUDIT_BINDS ) );
+ add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_BINDS_PAGE, AuditBindPage.class,
+ org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_BINDS ) );
- add( new SecureBookmarkablePageLink( GlobalIds.AUDIT_AUTHZS_PAGE, AuditAuthzPage.class,
- GlobalIds.ROLE_AUDIT_AUTHZS ) );
+ add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_AUTHZS_PAGE, AuditAuthzPage.class,
+ org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_AUTHZS ) );
- add( new SecureBookmarkablePageLink( GlobalIds.AUDIT_MODS_PAGE, AuditModPage.class,
- GlobalIds.ROLE_AUDIT_MODS ) );
+ add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_MODS_PAGE, AuditModPage.class,
+ org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_MODS ) );
add( new Label( "footer", "Copyright (c) 2003-2015, The Apache Software Foundation. All Rights Reserved." ) );
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/FtBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FtBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/FtBookmarkablePageLink.java
deleted file mode 100644
index 4f8a98d..0000000
--- a/src/main/java/org/apache/directory/fortress/web/FtBookmarkablePageLink.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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;
-
-
-import org.apache.directory.fortress.core.rbac.Permission;
-import org.apache.log4j.Logger;
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-
-
-/**
- * This link requires the id format be: objname.operationname
- * where name maps to ft perm obj name and op maps to ft perm op name.
- * If match not found link will quietly not display the link on page.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class FtBookmarkablePageLink extends BookmarkablePageLink
-{
- private static final Logger LOG = Logger.getLogger( FtBookmarkablePageLink.class.getName() );
- Permission perm;
-
- public <C extends Page> FtBookmarkablePageLink( String id, Class<C> pageClass )
- {
- super( id, pageClass );
- perm = SecUtils.getPermFromId( id );
- if ( perm != null && SecUtils.isFound( perm, this ) )
- {
- LOG.debug( "FtBookmarkablePageLink id: " + id + ", status found" );
- }
- else
- {
- LOG.debug( "FtBookmarkablePageLink id: " + id + ", status NOT found" );
- setVisible( false );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/FtIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FtIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/FtIndicatingAjaxButton.java
deleted file mode 100644
index eabf605..0000000
--- a/src/main/java/org/apache/directory/fortress/web/FtIndicatingAjaxButton.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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;
-
-import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
-import org.apache.log4j.Logger;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.core.*;
-import org.apache.directory.fortress.core.rbac.Permission;
-
-
-/**
- * ...
- *
- * @author Shawn McKinney
- * @version $Rev$
- */
-public class FtIndicatingAjaxButton extends IndicatingAjaxButton
-{
- Permission perm;
-
- @SpringBean
- private AccessMgr accessMgr;
-
- private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
-
- public FtIndicatingAjaxButton(String id)
- {
- super( id );
- String[] parts = id.split( "\\." );
- if(parts != null && parts.length > 1)
- {
- String objName = parts[0];
- String opName = parts[1];
- this.perm = new Permission(objName, opName);
- if ( SecUtils.isFound( perm, this ) )
- {
- LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status found" );
- }
- else
- {
- LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status NOT found" );
- setVisible( false );
- }
-
- }
- else
- {
- throw new RuntimeException( "FtIndicatingAjaxButton Constructor ID: " + id + ", requires objectname.opname format" );
- }
- }
-
- protected boolean checkAccess( )
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )getSession();
- isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
- LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
- LOG.error( error );
- }
- return isAuthorized;
- }
-
-
- protected boolean checkAccess( String objectId )
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )getSession();
- Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
- isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
- LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
- LOG.error( error );
- }
- return isAuthorized;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/GlobalIds.java b/src/main/java/org/apache/directory/fortress/web/GlobalIds.java
deleted file mode 100644
index ab73840..0000000
--- a/src/main/java/org/apache/directory/fortress/web/GlobalIds.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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;
-
-/**
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class GlobalIds
-{
- public static final String ROLE_USERS = "ROLE_USERS";
- public static final String ROLE_ROLES = "ROLE_ROLES";
- public static final String ROLE_PERMOBJS = "ROLE_PERMOBJS";
- public static final String ROLE_PERMS = "ROLE_PERMS";
- public static final String ROLE_SSDS = "ROLE_SSDS";
- public static final String ROLE_DSDS = "ROLE_DSDS";
- public static final String ROLE_USEROUS = "ROLE_USEROUS";
- public static final String ROLE_PERMOUS = "ROLE_PERMOUS";
- public static final String ROLE_POLICIES = "ROLE_POLICIES";
- public static final String ROLE_ADMINROLES = "ROLE_ADMINROLES";
- public static final String ROLE_ADMINOBJS = "ROLE_ADMINOBJS";
- public static final String ROLE_ADMINPERMS = "ROLE_ADMINPERMS";
- public static final String ROLE_AUDIT_AUTHZS = "ROLE_AUDIT_AUTHZS";
- public static final String ROLE_AUDIT_BINDS = "ROLE_AUDIT_BINDS";
- public static final String ROLE_AUDIT_MODS = "ROLE_AUDIT_MODS";
- public static final String ROLE_GROUPS = "ROLE_GROUPS";
- public static final String SSD = "SSD";
- public static final String DSD = "DSD";
- public static final String PAGE_TYPE = "type";
- public static final String ADMIN_MGR = "org.apache.directory.fortress.core.rbac.AdminMgrImpl";
- public static final String REVIEW_MGR = "org.apache.directory.fortress.core.rbac.ReviewMgrImpl";
- public static final String DEL_ADMIN_MGR = "org.apache.directory.fortress.core.rbac.DelAdminMgrImpl";
- public static final String DEL_REVIEW_MGR = "org.apache.directory.fortress.core.rbac.DelReviewMgrImpl";
- public static final String PWPOLICY_MGR = "org.apache.directory.fortress.core.rbac.PwPolicyMgrImpl";
- public static final String AUDIT_MGR = "org.apache.directory.fortress.core.rbac.AuditMgrImpl";
- public static final String GROUP_MGR = "org.apache.directory.fortress.core.ldap.group.GroupMgrImpl";
- public static final String ASSIGN_USER = "assignUser";
- public static final String ADD = "add";
- public static final String COMMIT = "commit";
- public static final String DELETE = "delete";
- public static final String CANCEL = "cancel";
- public static final String TIMEOUT_ARC = "timeoutARC";
- public static final String BEGIN_TIME_ARC = "beginTimeARC";
- public static final String END_TIME_ARC = "endTimeARC";
- public static final String BEGIN_DATE_ARC = "beginDateARC";
- public static final String END_DATE_ARC = "endDateARC";
- public static final String BEGIN_LOCK_DATE_ARC = "beginLockDateARC";
- public static final String END_LOCK_DATE_ARC = "endLockDateARC";
- public static final String BEGIN_TIME_RC = "beginTimeRC";
- public static final String END_TIME_RC = "endTimeRC";
- public static final String BEGIN_DATE_RC = "beginDateRC";
- public static final String END_DATE_RC = "endDateRC";
- public static final String BEGIN_LOCK_DATE_RC = "beginLockDateRC";
- public static final String END_LOCK_DATE_RC = "endLockDateRC";
- public static final String TIMEOUT_RC = "timeoutRC";
- public static final String SUNDAY_RC = "sundayRC";
- public static final String MONDAY_RC = "mondayRC";
- public static final String TUESDAY_RC = "tuesdayRC";
- public static final String WEDNESDAY_RC = "wednesdayRC";
- public static final String THURSDAY_RC = "thursdayRC";
- public static final String FRIDAY_RC = "fridayRC";
- public static final String SATURDAY_RC = "saturdayRC";
- public static final String ASSIGN = "assign";
- public static final String ROLE_ASSIGNMENTS_LABEL = "roleAssignmentsLabel";
- public static final String SELECT = "select";
- public static final String SEARCH = "search";
- public static final String CLEAR = "clear";
- public static final String SEARCH_VAL = "searchVal";
- public static final String MONDAY_ARC = "mondayARC";
- public static final String TUESDAY_ARC = "tuesdayARC";
- public static final String WEDNESDAY_ARC = "wednesdayARC";
- public static final String THURSDAY_ARC = "thursdayARC";
- public static final String FRIDAY_ARC = "fridayARC";
- public static final String ASSIGN_ADMIN_ROLE = "assignAdminRole";
- public static final String DESCRIPTION = "description";
- public static final String EMAILS = "emails";
- public static final String PHONES = "phones";
- public static final String MOBILES = "mobiles";
- public static final String ADDRESS_ASSIGNMENTS_LABEL = "addressAssignmentsLabel";
- public static final String ADDRESSES = "addresses";
- public static final String ADDRESS_CITY = "address.city";
- public static final String ADDRESS_STATE = "address.state";
- public static final String ADDRESS_COUNTRY = "address.country";
- public static final String ADDRESS_POSTAL_CODE = "address.postalCode";
- public static final String ADDRESS_POST_OFFICE_BOX = "address.postOfficeBox";
- public static final String ADDRESS_BUILDING = "address.building";
- public static final String ADDRESS_DEPARTMENT_NUMBER = "address.departmentNumber";
- public static final String ADDRESS_ROOM_NUMBER = "address.roomNumber";
- public static final String TEMPORAL_CONSTRAINTS_LABEL = "temporalConstraintsLabel";
- public static final String BEGIN_TIME_P = "beginTimeP";
- public static final String END_TIME_P = "endTimeP";
- public static final String BEGIN_DATE_P = "beginDateP";
- public static final String END_DATE_P = "endDateP";
- public static final String BEGIN_LOCK_DATE_P = "beginLockDateP";
- public static final String END_LOCK_DATE_P = "endLockDateP";
- public static final String TIMEOUT_P = "timeoutP";
- public static final String SUNDAY_P = "sundayP";
- public static final String MONDAY_P = "mondayP";
- public static final String TUESDAY_P = "tuesdayP";
- public static final String WEDNESDAY_P = "wednesdayP";
- public static final String THURSDAY_P = "thursdayP";
- public static final String FRIDAY_P = "fridayP";
- public static final String SATURDAY_P = "saturdayP";
- public static final String SYSTEM_INFO_LABEL = "systemInfoLabel";
- public static final String SYSTEM = "system";
- public static final String CN = "cn";
- public static final String SN = "sn";
- public static final String IMPORT_PHOTO_LABEL = "importPhotoLabel";
- public static final String SAVE = "save";
- public static final String NAME = "name";
- public static final String USER_ID = "userId";
- public static final String PSWD_FIELD = "pswdField";
- public static final String LOGIN = "login";
- public static final String EMPLOYEE_TYPE = "employeeType";
- public static final String TITLE = "title";
- public static final String GROUP_PAGE = "groups";
- public static final String AUDIT_AUTHZS_PAGE = "authzs";
- public static final String AUDIT_MODS_PAGE = "mods";
- public static final String AUDIT_BINDS_PAGE = "binds";
- public static final String JPEGPHOTO = "jpegPhoto";
- public static final String OU = "ou";
- public static final String REQ_AUTHZ_ID = "reqAuthzID";
- public static final String REQ_DN = "reqDN";
- public static final String REQ_RESULT = "reqResult";
- public static final String REQ_START = "reqStart";
- public static final String REQ_ATTR = "reqAttr";
- public static final String REQ_ATTRS_ONLY = "reqAttrsOnly";
- public static final String REQ_DEREF_ALIASES = "reqDerefAliases";
- public static final String AUTHZ_SUCCESS_CODE = "6";
- public static final String BIND_SUCCESS_CODE = "0";
- public static final String SUCCESS = "SUCCESS";
- public static final String FAILURE = "FAILURE";
- public static final String AUDIT_TIMESTAMP_FORMAT = "MM/dd/yyyy HH:mm:ss";
- public static final String FIND_USERS = "findUsers";
- public static final String FIND_PERMISSIONS = "findPermissions";
- public static final String ONBLUR = "onblur";
- public static final String ADDRESS_ADDRESSES = "address.addresses";
- public static final String FT_MOD_ID = "ftModId";
- public static final String FT_MODIFIER = "ftModifier";
- public static final String FT_MOD_CODE = "ftModCode";
-
- public static final String OBJ_NAME = "objName";
- public static final String OP_NAME = "opName";
- public static final String FAILED_ONLY = "failedOnly";
- public static final String ADMIN = "admin";
- public static final String GET_USER_AUTHZS = "getUserAuthZs";
- public static final String GET_USER_BINDS = "searchBinds";
- public static final String OBJECT_ID = "objId";
- public static final String USERS_PAGE = "users";
- public static final String ROLES_PAGE = "roles";
- public static final String ADMROLES_PAGE = "admroles";
- public static final String POBJS_PAGE = "pobjs";
- public static final String ADMPERMS_PAGE = "admperms";
- public static final String PERMS_PAGE = "perms";
- public static final String PWPOLICIES_PAGE = "pwpolicies";
- public static final String SSDS_PAGE = "ssds";
- public static final String DSDS_PAGE = "dsds";
- public static final String USEROUS_PAGE = "userous";
- public static final String PERMOUS_PAGE = "permous";
- public static final String ADMPOBJS_PAGE = "admpobjs";
- public static final String WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML = "window.location.replace(\"/fortress-web/home.html\");";
-
- public static final String WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE = "Wicket.Window.unloadConfirmation = false;";
- public static final String ADD_USER = "addUser";
- public static final String UPDATE_USER = "updateUser";
- public static final String DELETE_USER = "deleteUser";
- public static final String DEASSIGN = "deassign";
- public static final String DEASSIGN_USER = "deassignUser";
- public static final String NAVPANEL = "navpanel";
- public static final String INFOPANEL = "infopanel";
- public static final String OBJECTLISTPANEL = "objectlistpanel";
- public static final String OBJECTDETAILPANEL = "objectdetailpanel";
- public static final String OULISTPANEL = "oulistpanel";
- public static final String OUDETAILPANEL = "oudetailpanel";
- public static final String PERMLISTPANEL = "permlistpanel";
- public static final String PERMDETAILPANEL = "permdetailpanel";
- public static final String ROLELISTPANEL = "rolelistpanel";
- public static final String ROLEDETAILPANEL = "roledetailpanel";
- public static final String SDLISTPANEL = "sdlistpanel";
- public static final String SDDETAILPANEL = "sddetailpanel";
- public static final String GROUPLISTPANEL = "grouplistpanel";
- public static final String GROUPDETAILPANEL = "groupdetailpanel";
- public static final String LAYOUT = "layout";
- public static final String PAGE_HEADER = "pageHeader";
- public static final String DETAIL_FIELDS = "detailFields";
- public static final String EDIT_FIELDS = "editFields";
- public static final String USERAUDITDETAILPANEL = "userauditdetailpanel";
- public static final String BEGIN_DATE = "beginDate";
- public static final String END_DATE = "endDate";
-
- public static final String FIND_ROLES = "findRoles";
- public static final String ROLEAUXPANEL = "roleauxpanel";
- public static final String ADD_ROLE = "addRole";
- public static final String UPDATE_ROLE = "updateRole";
- public static final String DELETE_ROLE = "deleteRole";
- public static final String PARENTS = "parents";
- public static final String OS_P = "osP";
- public static final String OS_U = "osU";
- public static final String BEGIN_RANGE = "beginRange";
- public static final String BEGIN_INCLUSIVE = "beginInclusive";
- public static final String END_RANGE = "endRange";
- public static final String END_INCLUSIVE = "endInclusive";
- public static final String PERMOU_SEARCH = "permou.search";
- public static final String USEROU_SEARCH = "userou.search";
- public static final String BEGIN_RANGE_SEARCH = "beginRange.search";
- public static final String END_RANGE_SEARCH = "endRange.search";
- public static final String PARENTROLES_SEARCH = "parentroles.search";
- public static final String POLICY_SEARCH = "policy.search";
- public static final String OU_SEARCH = "ou.search";
- public static final String ROLES_SEARCH = "roles.search";
- public static final String FIELD_2 = "field2";
- public static final String FIELD_1 = "field1";
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/GroupListModel.java b/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
deleted file mode 100644
index fb950bd..0000000
--- a/src/main/java/org/apache/directory/fortress/web/GroupListModel.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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;
-
-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/GroupPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/GroupPage.java b/src/main/java/org/apache/directory/fortress/web/GroupPage.java
index ea88029..dd991e3 100644
--- a/src/main/java/org/apache/directory/fortress/web/GroupPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/GroupPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -40,11 +41,11 @@ public class GroupPage extends FortressWebBasePage
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
- private String label = "LDAP Group Page";
public GroupPage( PageParameters parameters )
{
+ String label = "LDAP Group Page";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter( "40", "60" );
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/OUListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/OUListModel.java b/src/main/java/org/apache/directory/fortress/web/OUListModel.java
deleted file mode 100644
index 5bcd754..0000000
--- a/src/main/java/org/apache/directory/fortress/web/OUListModel.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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;
-
-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/ObjectAdminPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/ObjectAdminPage.java b/src/main/java/org/apache/directory/fortress/web/ObjectAdminPage.java
index 3465dbe..df953ab 100644
--- a/src/main/java/org/apache/directory/fortress/web/ObjectAdminPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/ObjectAdminPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class ObjectAdminPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = true;
- private String label = "Administrative Permission Object Page";
public ObjectAdminPage( PageParameters parameters )
{
+ String label = "Administrative Permission Object Page";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java b/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
deleted file mode 100644
index c97b2f8..0000000
--- a/src/main/java/org/apache/directory/fortress/web/ObjectListModel.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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;
-
-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;
- }
-}
[2/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
Posted by sm...@apache.org.
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 );
}
[4/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/ObjectPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/ObjectPage.java b/src/main/java/org/apache/directory/fortress/web/ObjectPage.java
index c7bf423..58fe040 100644
--- a/src/main/java/org/apache/directory/fortress/web/ObjectPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/ObjectPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class ObjectPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = false;
- private String label = "Permission Object Page";
public ObjectPage( PageParameters parameters )
{
+ String label = "Permission Object Page";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/OuPermPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/OuPermPage.java b/src/main/java/org/apache/directory/fortress/web/OuPermPage.java
index a518069..bc49199 100644
--- a/src/main/java/org/apache/directory/fortress/web/OuPermPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/OuPermPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class OuPermPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isUser = false;
- private String label = "Permission Organizational Unit Administration";
public OuPermPage( PageParameters parameters )
{
+ String label = "Permission Organizational Unit Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/OuUserPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/OuUserPage.java b/src/main/java/org/apache/directory/fortress/web/OuUserPage.java
index 8936e56..bc15312 100644
--- a/src/main/java/org/apache/directory/fortress/web/OuUserPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/OuUserPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class OuUserPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isUser = true;
- private String label = "User Organizational Unit Administration";
public OuUserPage( PageParameters parameters )
{
+ String label = "User Organizational Unit Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java b/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java
index a5553f8..af6fc48 100644
--- a/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class PermAdminPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = true;
- private String label = "Administrative Permission Operation Page";
public PermAdminPage( PageParameters parameters )
{
+ String label = "Administrative Permission Operation Page";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/PermListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PermListModel.java b/src/main/java/org/apache/directory/fortress/web/PermListModel.java
deleted file mode 100644
index 812395e..0000000
--- a/src/main/java/org/apache/directory/fortress/web/PermListModel.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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;
-
-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/PermPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PermPage.java b/src/main/java/org/apache/directory/fortress/web/PermPage.java
index 81ecfc1..c563636 100644
--- a/src/main/java/org/apache/directory/fortress/web/PermPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/PermPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class PermPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = false;
- private String label = "Permission Operation Page";
public PermPage( PageParameters parameters )
{
+ String label = "Permission Operation Page";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java b/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
deleted file mode 100644
index fd35004..0000000
--- a/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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;
-
-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/PwPolicyPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/PwPolicyPage.java b/src/main/java/org/apache/directory/fortress/web/PwPolicyPage.java
index 2c0e798..1ffa343 100644
--- a/src/main/java/org/apache/directory/fortress/web/PwPolicyPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/PwPolicyPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java b/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java
index b26cd34..16bf1bd 100644
--- a/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
@@ -45,7 +46,6 @@ public class RoleAdminPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = true;
- private String label = "Admin Role Administration";
private static final Logger LOG = Logger.getLogger( RoleAdminPage.class.getName() );
@@ -56,6 +56,7 @@ public class RoleAdminPage extends FortressWebBasePage
*/
public RoleAdminPage( PageParameters parameters )
{
+ String label = "Admin Role Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/RoleListModel.java b/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
deleted file mode 100644
index 927a726..0000000
--- a/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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;
-
-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/RolePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/RolePage.java b/src/main/java/org/apache/directory/fortress/web/RolePage.java
index 772b1e8..d049a71 100644
--- a/src/main/java/org/apache/directory/fortress/web/RolePage.java
+++ b/src/main/java/org/apache/directory/fortress/web/RolePage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.log4j.Logger;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
@@ -42,12 +43,12 @@ public class RolePage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isAdmin = false;
- private String label = "RBAC Role Administration";
private static final Logger LOG = Logger.getLogger( RolePage.class.getName() );
public RolePage( PageParameters parameters )
{
+ String label = "RBAC Role Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SDListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SDListModel.java b/src/main/java/org/apache/directory/fortress/web/SDListModel.java
deleted file mode 100644
index bae021a..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SDListModel.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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;
-
-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/SaveModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SaveModelEvent.java b/src/main/java/org/apache/directory/fortress/web/SaveModelEvent.java
deleted file mode 100644
index 227f102..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SaveModelEvent.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.request.ILogData;
-import org.apache.wicket.request.IRequestCycle;
-import org.apache.wicket.request.component.IRequestablePage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.directory.fortress.core.rbac.FortEntity;
-
-import java.util.Collection;
-
-/**
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SaveModelEvent extends AjaxUpdateEvent
-{
- private int index = 0;
- private FortEntity entity;
-
- public Operations getOperation()
- {
- return operation;
- }
-
- public void setOperation(Operations operation)
- {
- this.operation = operation;
- }
-
- private Operations operation;
-
- public enum Operations
- {
- ADD,
- UPDATE,
- SEARCH,
- DELETE
- }
-
- public SaveModelEvent(AjaxRequestTarget target)
- {
- super(target);
- }
-
- public SaveModelEvent(AjaxRequestTarget target, int index)
- {
- super(target);
- this.index = index;
- }
-
- public SaveModelEvent(AjaxRequestTarget target, FortEntity entity)
- {
- super(target);
- this.entity = entity;
- }
-
- public SaveModelEvent(AjaxRequestTarget target, FortEntity entity, Operations operation)
- {
- super(target);
- this.entity = entity;
- this.operation = operation;
- }
-
- public int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public FortEntity getEntity()
- {
- return entity;
- }
-
- public void setEntity(FortEntity entity)
- {
- this.entity = entity;
- }
-
- public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target, Operations operation)
- {
- component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity, operation));
- }
-
- public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
- {
- component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
- }
-
- public static void send(Page page, Component component, FortEntity entity)
- {
- AjaxRequestTarget target = new AjaxRequestTarget()
- {
- @Override
- public void add(Component component, String markupId)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- //component.
- }
- @Override
- public void add(Component... components)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void addChildren(MarkupContainer parent, Class<?> childCriteria)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void addListener(IListener listener)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void appendJavaScript(CharSequence javascript)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void prependJavaScript(CharSequence javascript)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void registerRespondListener(ITargetRespondListener listener)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Collection<? extends Component> getComponents()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void focusComponent(Component component)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public IHeaderResponse getHeaderResponse()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public String getLastFocusedElementId()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Page getPage()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public ILogData getLogData()
-
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Integer getPageId()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public boolean isPageInstanceCreated()
- {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Integer getRenderCount()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Class<? extends IRequestablePage> getPageClass()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public PageParameters getPageParameters()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void respond(IRequestCycle iRequestCycle)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void detach(IRequestCycle iRequestCycle)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- };
-/*
- //AjaxRequestTarget target = AjaxRequestTarget.get();
- if (target != null) { //...then this is an ajax request, not a static one
- target.addComponent(myComponent);
- }
-*/
- component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java b/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java
index 55cab8f..1c09e82 100644
--- a/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,12 @@ public class SdDynamicPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isStatic = false;
- private String label = "Dynamic Separation of Duties Administration";;
+ ;
public SdDynamicPage( PageParameters parameters )
{
+ String label = "Dynamic Separation of Duties Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java b/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java
index 81fef82..a003823 100644
--- a/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -41,11 +42,11 @@ public class SdStaticPage extends FortressWebBasePage
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
private boolean isStatic = true;
- private String label = "Static Separation of Duties Administration";
public SdStaticPage( PageParameters parameters )
{
+ String label = "Static Separation of Duties Administration";
add( new Label( GlobalIds.PAGE_HEADER, label ) );
WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
FourWaySplitter splitter = new FourWaySplitter();
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SecUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SecUtils.java b/src/main/java/org/apache/directory/fortress/web/SecUtils.java
deleted file mode 100644
index 3553a64..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SecUtils.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * 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;
-
-import org.apache.directory.fortress.core.*;
-import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.cfg.Config;
-import org.apache.directory.fortress.core.rbac.UserRole;
-import org.apache.directory.fortress.core.rbac.Warning;
-import org.apache.directory.fortress.realm.*;
-import org.apache.directory.fortress.realm.GlobalIds;
-import org.apache.log4j.Logger;
-import org.apache.wicket.Component;
-import org.apache.directory.fortress.core.rbac.Permission;
-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.wicket.ajax.AjaxRequestTarget;
-
-import javax.servlet.http.HttpServletRequest;
-import java.security.Principal;
-import java.util.List;
-
-/**
- * Common static utils and wrappers used by Wicket web apps to make fortress style security calls.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SecUtils
-{
- private static final Logger LOG = Logger.getLogger( SecUtils.class.getName() );
- private static final String PERMS_CACHED = "perms.cached";
- public static final boolean IS_PERM_CACHED = ( ( Config.getProperty( PERMS_CACHED ) != null ) && ( Config
- .getProperty( PERMS_CACHED ).equalsIgnoreCase( "true" ) ) );
-
- /**
- * Return the fortress session that is cached within the wicket session object.
- *
- * @param component needed to get handle to wicket session.
- * @return fortress session object.
- */
- public static Session getSession(Component component)
- {
- return ( ( WicketSession ) component.getSession() ).getSession();
- }
-
- /**
- * Used when web app needs to create a 'trusted' fortress session.
- *
- * Does not check user's password.
- *
- * @param accessMgr fortress access mgr apis
- * @param userId required for rbac session creation.
- * @return rbac session.
- */
- public static Session createSession(AccessMgr accessMgr, String userId)
- {
- Session session;
- try
- {
- // Create an RBAC session and attach to Wicket session:
- session = accessMgr.createSession( new User( userId ), true );
- String message = "RBAC Session successfully created for userId: " + session.getUserId();
- LOG.debug( message );
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String error = "createSession caught SecurityException=" + se;
- LOG.error( error );
- throw new RuntimeException( error );
- }
- return session;
- }
-
- /**
- * Here the wicket session is loaded with the fortress session and permissions.
- *
- *
- * @param delAccessMgr needed to pull back fortress arbac permissions.
- * @param session needed for call into accessMgr.
- */
- public static void loadPermissionsIntoSession( DelAccessMgr delAccessMgr, Session session)
- {
- try
- {
- // Retrieve user permissions and attach fortress session to Wicket session:
- ( ( WicketSession ) WicketSession.get() ).setSession( session );
- List<Permission> permissions = delAccessMgr.sessionPermissions( session );
- ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
- String message = "Session successfully created for userId: " + session.getUserId();
- LOG.debug( message );
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String error = "loadPermissionsIntoSession caught SecurityException=" + se;
- LOG.error( error );
- throw new RuntimeException( error );
- }
- }
-
- /**
- * Returns the fortress arbac perms that are cashed in the wicket session.
- *
- * @param component needed to get a handle on the wicket session object.
- * @return collection of fortress admin perms.
- */
- public static List<Permission> getPermissions(Component component)
- {
- return ( ( WicketSession ) component.getSession() ).getPermissions();
- }
-
- /**
- * Retrieve RBAC session permissions from Fortress and place in the Wicket session.
- */
- public static void getPermissions( Component component, AccessMgr accessMgr )
- {
- try
- {
- if ( IS_PERM_CACHED )
- {
- WicketSession session = ( WicketSession ) component.getSession();
- List<Permission> permissions = accessMgr.sessionPermissions( session.getSession() );
- ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
- }
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String error = "getPermissions caught SecurityException=" + se;
- LOG.error( error );
- throw new RuntimeException( error );
- }
- }
-
- /**
- * Wrapper for the httpservlet isUserInRole api.
- *
- * @param roleName contains the name of role being checked.
- * @param servletReq handle used to make inquiry.
- * @return true if authorized, false otherwise.
- */
- public static boolean isAuthorized( String roleName, HttpServletRequest servletReq )
- {
- boolean isAuthorized = false;
- if ( servletReq.isUserInRole( roleName ) )
- {
- isAuthorized = true;
- }
- return isAuthorized;
- }
-
- /**
- * Is the supplied permission in the wicket session cache? Called by buttons.
- * if not found, button will be invisible.
- *
- * @param permission fortress perm requires {link @Permission#objName} and {link @Permission#opName} are set.
- * @param component needed to get handle on the wicket session object.
- * @return true if found, false otherwise
- */
- public static boolean isFound( Permission permission, Component component )
- {
- List<Permission> permissions = SecUtils.getPermissions( component );
- return VUtil.isNotNullOrEmpty( permissions ) && permissions.contains( permission );
- }
-
- /**
- * Wrapper to fortress checkAccess api.
- *
- * @param component contains the wicket session handle.
- * @param accessMgr has the checkAccess api
- * @param objName string value
- * @param opName string value
- * @param objId string value
- * @return true if success, false otherwise.
- * @throws org.apache.directory.fortress.core.SecurityException checked exception for system errors.
- */
- public static boolean checkAccess(Component component, AccessMgr accessMgr, String objName, String opName, String objId ) throws org.apache.directory.fortress.core.SecurityException
- {
- WicketSession session = ( WicketSession )component.getSession();
- Permission permission = new Permission( objName, opName, objId );
- return accessMgr.checkAccess( session.getSession(), permission );
- }
-
- /**
- * Convert the principal into fortress session and load into wicket session along with perms.
- *
- * @param component contains handle to wicket session.
- * @param j2eePolicyMgr used to call deserize api
- * @param accessMgr used to call fortress api for role op
- * @param szPrincipal contains the instance of fortress session deserialized.
- */
- public static void initializeSession(Component component, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr, String szPrincipal ) throws SecurityException
- {
- Session realmSession = null;
-
- if(j2eePolicyMgr == null || accessMgr == null)
- {
- throw new SecurityException( GlobalIds.SESSION_INITIALIZATION_FAILED, "initializeSession failed - verify the injection of fortress spring beans into your application" );
- }
- try
- {
- if(VUtil.isNotNullOrEmpty( szPrincipal ))
- realmSession = j2eePolicyMgr.deserialize( szPrincipal );
- }
- catch( SecurityException se )
- {
- throw new RuntimeException( se );
- }
- if(realmSession != null)
- {
- synchronized ( ( WicketSession ) WicketSession.get() )
- {
- if ( SecUtils.getSession( component ) == null )
- {
- LOG.info( "realmSession user: " + realmSession.getUserId() );
- // Retrieve user permissions and attach RBAC session to Wicket session:
- ( ( WicketSession ) WicketSession.get() ).setSession( realmSession );
- getPermissions( component, accessMgr );
- }
- }
- }
- }
-
- /**
- * Call RBAC addActiveRole to activate a new role into user's session.
- * This routine must first retrieves the wicket session.
- * It is needed because it contains the fortress session which is required for api.
- * Next it invokes the fortress addActiveRole method.
- * If all successful refresh user's perms cached as they've changed.
- *
- * @param component contains handle to wicket session.
- * @param target used to display modal if something goes wrong
- * @param accessMgr used to call fortress api for role op
- * @param roleName contains the role name target
- * @return true if success, false otherwise.
- */
- public static boolean addActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
- {
- boolean isSuccessful = false;
- try
- {
- WicketSession session = ( WicketSession ) component.getSession();
- session.getSession().setWarnings( null );
- accessMgr.addActiveRole( session.getSession(), new UserRole( roleName ) );
- List<Warning> warnings = session.getSession().getWarnings();
- if ( VUtil.isNotNullOrEmpty( warnings ) )
- {
- for ( Warning warning : warnings )
- {
- LOG.info( "Warning: " + warning.getMsg() + " errCode: " + warning.getId() + " name: " + warning
- .getName() + " type: " + warning.getType().toString() );
- if ( warning.getType() == Warning.Type.ROLE && warning.getName().equalsIgnoreCase( roleName ) )
- {
- String error = warning.getMsg() + " code: " + warning.getId();
- LOG.error( error );
- target.appendJavaScript( ";alert('" + error + "');" );
- return false;
- }
- }
- }
-
- // User's active role set changed so refresh their permissions:
- SecUtils.getPermissions( component, accessMgr );
- isSuccessful = true;
- String message = "Activate role name: " + roleName + " successful";
- LOG.info( message );
- }
- catch ( org.apache.directory.fortress.core.SecurityException se )
- {
- String msg = "Role selection " + roleName + " activation failed because of ";
- if ( se.getErrorId() == GlobalErrIds.DSD_VALIDATION_FAILED )
- {
- msg += "Dynamic SoD rule violation";
- }
- else if ( se.getErrorId() == GlobalErrIds.URLE_ALREADY_ACTIVE )
- {
- msg += "Role already active in Session";
- }
- else
- {
- msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
- }
- LOG.error( msg );
- target.appendJavaScript( ";alert('" + msg + "');" );
- }
- return isSuccessful;
- }
-
- /**
- * Call RBAC dropActiveRole to deactivate a new role from user's session.
- * This routine must first retrieves the wicket session.
- * It is needed because it contains the fortress session which is required for api.
- * Next it invokes the fortress dropActiveRole method.
- * If all successful refresh user's perms cached as they've changed.
- *
- * @param component contains handle to wicket session.
- * @param target used to display modal if something goes wrong
- * @param accessMgr used to call fortress api for role op
- * @param roleName contains the role name target
- * @return true if success, false otherwise.
- */
- public static boolean dropActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
- {
- boolean isSuccessful = false;
- try
- {
- WicketSession session = ( WicketSession ) component.getSession();
- accessMgr.dropActiveRole( session.getSession(), new UserRole( roleName ) );
- // User's active role set changed so refresh their permissions:
- SecUtils.getPermissions( component, accessMgr );
- isSuccessful = true;
- LOG.info( "Fortress dropActiveRole roleName: " + roleName + " was successful" );
- }
- catch ( SecurityException se )
- {
- String msg = "Role selection " + roleName + " deactivation failed because of ";
- if ( se.getErrorId() == GlobalErrIds.URLE_NOT_ACTIVE )
- {
- msg += "Role not active in session";
- }
- else
- {
- msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
- }
- LOG.error( msg );
- target.appendJavaScript( ";alert('" + msg + "');" );
- }
- return isSuccessful;
- }
-
- /**
- * Enables fortress session on behalf of a java.security.Principal retrieved from the container.
- *
- * @param component
- * @param servletReq
- * @param j2eePolicyMgr
- * @param accessMgr
- * @throws SecurityException
- */
- public static void enableFortress( Component component, HttpServletRequest servletReq, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr ) throws SecurityException
- {
- // Get the principal from the container:
- Principal principal = servletReq.getUserPrincipal();
- // Is this a Java EE secured page && has the User successfully authenticated already?
- boolean isSecured = principal != null;
- if(isSecured)
- {
- //linksLabel += " for " + principal.getName();
- if( !isLoggedIn( component ) )
- {
- String szPrincipal = principal.toString();
- // Pull the fortress session from the realm and assert into the Web app's session along with user's perms:
- SecUtils.initializeSession( component, j2eePolicyMgr, accessMgr, szPrincipal );
- }
- }
- }
-
- /**
- * If user has a wicket session then considered logged in.
- *
- * @return true if wicket session is not null
- */
- public static boolean isLoggedIn( Component component )
- {
- boolean isLoggedIn = false;
- if ( getSession( component ) != null )
- {
- isLoggedIn = true;
- }
- return isLoggedIn;
- }
-
- public static Permission getPermFromId( String id )
- {
- Permission perm = null;
- String[] parts = id.split( "\\." );
- if(parts != null && parts.length > 1)
- {
- String objName = parts[0];
- String opName = parts[1];
- perm = new Permission( objName, opName );
- }
- return perm;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SecureBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SecureBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/SecureBookmarkablePageLink.java
deleted file mode 100644
index fedc6bd..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SecureBookmarkablePageLink.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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;
-
-
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.StringTokenizer;
-
-
-/**
- * ...
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SecureBookmarkablePageLink extends BookmarkablePageLink
-{
- public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, String roleName )
- {
- super( id, pageClass );
- if(!isAuthorized( roleName ))
- {
- setVisible( false );
- }
- }
-
- public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, PageParameters parameters,
- String roleName )
- {
- super( id, pageClass, parameters );
- if ( !isAuthorized( roleName ) )
- {
- setVisible( false );
- }
- }
-
- private boolean isAuthorized( String roleName )
- {
- HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
- return isAuthorized( roleName, servletReq );
- }
-
- private boolean isAuthorized( String roleNames, HttpServletRequest servletReq )
- {
- boolean isAuthorized = false;
- StringTokenizer tokenizer = new StringTokenizer( roleNames, "," );
- if (tokenizer.countTokens() > 0)
- {
- while (tokenizer.hasMoreTokens())
- {
- String roleName = tokenizer.nextToken();
- isAuthorized = SecUtils.isAuthorized( roleName, servletReq );
- }
- }
- return isAuthorized;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxButton.java
deleted file mode 100644
index ac548d1..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxButton.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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;
-
-import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
-import org.apache.log4j.Logger;
-import org.apache.wicket.Component;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.core.*;
-import org.apache.directory.fortress.core.rbac.Permission;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * ...
- *
- * @author Shawn McKinney
- * @version $Rev$
- */
-public class SecureIndicatingAjaxButton extends IndicatingAjaxButton
-{
- Permission perm;
-
- @SpringBean
- private AccessMgr accessMgr;
-
- private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
-
- public SecureIndicatingAjaxButton( Component component, String id, String objectName, String opName )
- {
- super( id );
- this.perm = new Permission(objectName, opName);
- if( SecUtils.IS_PERM_CACHED)
- {
- if(!SecUtils.isFound( perm, this ))
- setVisible( false );
- }
- else
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )component.getSession();
- isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
- LOG.info( "Fortress checkAccess objectName: " + objectName + " operationName: " + opName + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objectName: " + objectName + " operationName: " + opName + " error=" + se;
- LOG.error( error );
- }
- if(!isAuthorized)
- setVisible( false );
- }
- }
-
- public SecureIndicatingAjaxButton( String id, String roleName )
- {
- super( id );
- HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
- if( ! SecUtils.isAuthorized( roleName, servletReq ) )
- setVisible( false );
- }
-
- public SecureIndicatingAjaxButton( String id, String objName, String opName )
- {
- super( id );
- if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
- setVisible( false );
- }
-
- protected boolean checkAccess( String objectName, String opName )
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )getSession();
- Permission permission = new Permission( objectName, opName );
- //Permission permission = new Permission( objectName, perm.getOpName() );
- isAuthorized = accessMgr.checkAccess( session.getSession(), permission );
- LOG.info( "Fortress checkAccess objectName: " + permission.getObjName() + " operationName: " + permission.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " operationName: " + this.perm.getOpName() + " error=" + se;
- LOG.error( error );
- }
- return isAuthorized;
- }
-
- protected boolean checkAccess( )
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )getSession();
- isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
- LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
- LOG.error( error );
- }
- return isAuthorized;
- }
-
-
- protected boolean checkAccess( String objectId )
- {
- boolean isAuthorized = false;
- try
- {
- WicketSession session = ( WicketSession )getSession();
- Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
- isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
- LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
- }
- catch(org.apache.directory.fortress.core.SecurityException se)
- {
- String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
- LOG.error( error );
- }
- return isAuthorized;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxLink.java b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxLink.java
deleted file mode 100644
index 1b36060..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxLink.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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;
-
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
-import org.apache.directory.fortress.core.rbac.Permission;
-
-
-/**
- * ...
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SecureIndicatingAjaxLink extends IndicatingAjaxLink
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
-
-
- public SecureIndicatingAjaxLink( String id, String objName, String opName )
- {
- super( id );
- if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
- setEnabled( false );
- }
-
-
- @Override
- public void onClick( AjaxRequestTarget target )
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SelectModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SelectModelEvent.java b/src/main/java/org/apache/directory/fortress/web/SelectModelEvent.java
deleted file mode 100644
index 620dd70..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SelectModelEvent.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.request.ILogData;
-import org.apache.wicket.request.IRequestCycle;
-import org.apache.wicket.request.component.IRequestablePage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.directory.fortress.core.rbac.FortEntity;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SelectModelEvent extends AjaxUpdateEvent
-{
- private int index = 0;
- private FortEntity entity;
-
- public SelectModelEvent(AjaxRequestTarget target)
- {
- super(target);
- }
-
- public SelectModelEvent(AjaxRequestTarget target, int index)
- {
- super(target);
- this.index = index;
- }
-
- public SelectModelEvent(AjaxRequestTarget target, FortEntity entity)
- {
- super(target);
- this.entity = entity;
- }
-
- public int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public FortEntity getEntity()
- {
- return entity;
- }
-
- public void setEntity(FortEntity entity)
- {
- this.entity = entity;
- }
-
- public static void send(Page page, Component component, FortEntity entity)
- {
- AjaxRequestTarget target = new AjaxRequestTarget()
- {
- @Override
- public void add(Component component, String markupId)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- //component.
- }
- @Override
- public void add(Component... components)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void addChildren(MarkupContainer parent, Class<?> childCriteria)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void addListener(IListener listener)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void appendJavaScript(CharSequence javascript)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void prependJavaScript(CharSequence javascript)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void registerRespondListener(ITargetRespondListener listener)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Collection<? extends Component> getComponents()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void focusComponent(Component component)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public IHeaderResponse getHeaderResponse()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public String getLastFocusedElementId()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Page getPage()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public ILogData getLogData()
-
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Integer getPageId()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public boolean isPageInstanceCreated()
- {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Integer getRenderCount()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public Class<? extends IRequestablePage> getPageClass()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public PageParameters getPageParameters()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void respond(IRequestCycle iRequestCycle)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- @Override
- public void detach(IRequestCycle iRequestCycle)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- };
- component.send(page, Broadcast.BREADTH, new SelectModelEvent(target, entity));
- }
-
- public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
- {
- component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/SerializableList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/SerializableList.java b/src/main/java/org/apache/directory/fortress/web/SerializableList.java
deleted file mode 100644
index 084a204..0000000
--- a/src/main/java/org/apache/directory/fortress/web/SerializableList.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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;
-
-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 );
- }
-}
[3/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
Posted by sm...@apache.org.
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/UserListModel.java b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
deleted file mode 100644
index 6fff40e..0000000
--- a/src/main/java/org/apache/directory/fortress/web/UserListModel.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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;
-
-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/UserPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/UserPage.java b/src/main/java/org/apache/directory/fortress/web/UserPage.java
index b8ac179..1fc1f99 100644
--- a/src/main/java/org/apache/directory/fortress/web/UserPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/UserPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/WicketSession.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/WicketSession.java b/src/main/java/org/apache/directory/fortress/web/WicketSession.java
deleted file mode 100644
index 9e8bb7a..0000000
--- a/src/main/java/org/apache/directory/fortress/web/WicketSession.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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;
-
-
-import org.apache.wicket.protocol.http.WebSession;
-import org.apache.wicket.request.Request;
-import org.apache.directory.fortress.core.rbac.Permission;
-import org.apache.directory.fortress.core.rbac.Session;
-
-import java.util.List;
-
-
-/**
- * This object is managed by wicket framework. It is used to cache a copy of a user's session and permissions.
- *
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class WicketSession extends WebSession
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
- private Session session;
- private List<Permission> permissions;
-
-
- /**
- * Constructor. Note that {@link org.apache.wicket.request.cycle.RequestCycle} is not available until this
- * constructor returns.
- *
- * @param request The current request
- */
- public WicketSession(Request request)
- {
- super( request );
- }
-
-
- public Session getSession()
- {
- return session;
- }
-
-
- public void setSession(Session session)
- {
- this.session = session;
- }
-
-
- public List<Permission> getPermissions()
- {
- return permissions;
- }
-
-
- public void setPermissions( List<Permission> permissions )
- {
- this.permissions = permissions;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
new file mode 100644
index 0000000..5be0c5b
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
@@ -0,0 +1,231 @@
+/*
+ * 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.common;
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class GlobalIds
+{
+ public static final String ROLE_USERS = "ROLE_USERS";
+ public static final String ROLE_ROLES = "ROLE_ROLES";
+ public static final String ROLE_PERMOBJS = "ROLE_PERMOBJS";
+ public static final String ROLE_PERMS = "ROLE_PERMS";
+ public static final String ROLE_SSDS = "ROLE_SSDS";
+ public static final String ROLE_DSDS = "ROLE_DSDS";
+ public static final String ROLE_USEROUS = "ROLE_USEROUS";
+ public static final String ROLE_PERMOUS = "ROLE_PERMOUS";
+ public static final String ROLE_POLICIES = "ROLE_POLICIES";
+ public static final String ROLE_ADMINROLES = "ROLE_ADMINROLES";
+ public static final String ROLE_ADMINOBJS = "ROLE_ADMINOBJS";
+ public static final String ROLE_ADMINPERMS = "ROLE_ADMINPERMS";
+ public static final String ROLE_AUDIT_AUTHZS = "ROLE_AUDIT_AUTHZS";
+ public static final String ROLE_AUDIT_BINDS = "ROLE_AUDIT_BINDS";
+ public static final String ROLE_AUDIT_MODS = "ROLE_AUDIT_MODS";
+ public static final String ROLE_GROUPS = "ROLE_GROUPS";
+ public static final String SSD = "SSD";
+ public static final String DSD = "DSD";
+ public static final String PAGE_TYPE = "type";
+ public static final String ADMIN_MGR = "org.apache.directory.fortress.core.rbac.AdminMgrImpl";
+ public static final String REVIEW_MGR = "org.apache.directory.fortress.core.rbac.ReviewMgrImpl";
+ public static final String DEL_ADMIN_MGR = "org.apache.directory.fortress.core.rbac.DelAdminMgrImpl";
+ public static final String DEL_REVIEW_MGR = "org.apache.directory.fortress.core.rbac.DelReviewMgrImpl";
+ public static final String PWPOLICY_MGR = "org.apache.directory.fortress.core.rbac.PwPolicyMgrImpl";
+ public static final String AUDIT_MGR = "org.apache.directory.fortress.core.rbac.AuditMgrImpl";
+ public static final String GROUP_MGR = "org.apache.directory.fortress.core.ldap.group.GroupMgrImpl";
+ public static final String ASSIGN_USER = "assignUser";
+ public static final String ADD = "add";
+ public static final String COMMIT = "commit";
+ public static final String DELETE = "delete";
+ public static final String CANCEL = "cancel";
+ public static final String TIMEOUT_ARC = "timeoutARC";
+ public static final String BEGIN_TIME_ARC = "beginTimeARC";
+ public static final String END_TIME_ARC = "endTimeARC";
+ public static final String BEGIN_DATE_ARC = "beginDateARC";
+ public static final String END_DATE_ARC = "endDateARC";
+ public static final String BEGIN_LOCK_DATE_ARC = "beginLockDateARC";
+ public static final String END_LOCK_DATE_ARC = "endLockDateARC";
+ public static final String BEGIN_TIME_RC = "beginTimeRC";
+ public static final String END_TIME_RC = "endTimeRC";
+ public static final String BEGIN_DATE_RC = "beginDateRC";
+ public static final String END_DATE_RC = "endDateRC";
+ public static final String BEGIN_LOCK_DATE_RC = "beginLockDateRC";
+ public static final String END_LOCK_DATE_RC = "endLockDateRC";
+ public static final String TIMEOUT_RC = "timeoutRC";
+ public static final String SUNDAY_RC = "sundayRC";
+ public static final String MONDAY_RC = "mondayRC";
+ public static final String TUESDAY_RC = "tuesdayRC";
+ public static final String WEDNESDAY_RC = "wednesdayRC";
+ public static final String THURSDAY_RC = "thursdayRC";
+ public static final String FRIDAY_RC = "fridayRC";
+ public static final String SATURDAY_RC = "saturdayRC";
+ public static final String ASSIGN = "assign";
+ public static final String ROLE_ASSIGNMENTS_LABEL = "roleAssignmentsLabel";
+ public static final String SELECT = "select";
+ public static final String SEARCH = "search";
+ public static final String CLEAR = "clear";
+ public static final String SEARCH_VAL = "searchVal";
+ public static final String MONDAY_ARC = "mondayARC";
+ public static final String TUESDAY_ARC = "tuesdayARC";
+ public static final String WEDNESDAY_ARC = "wednesdayARC";
+ public static final String THURSDAY_ARC = "thursdayARC";
+ public static final String FRIDAY_ARC = "fridayARC";
+ public static final String ASSIGN_ADMIN_ROLE = "assignAdminRole";
+ public static final String DESCRIPTION = "description";
+ public static final String EMAILS = "emails";
+ public static final String PHONES = "phones";
+ public static final String MOBILES = "mobiles";
+ public static final String ADDRESS_ASSIGNMENTS_LABEL = "addressAssignmentsLabel";
+ public static final String ADDRESSES = "addresses";
+ public static final String ADDRESS_CITY = "address.city";
+ public static final String ADDRESS_STATE = "address.state";
+ public static final String ADDRESS_COUNTRY = "address.country";
+ public static final String ADDRESS_POSTAL_CODE = "address.postalCode";
+ public static final String ADDRESS_POST_OFFICE_BOX = "address.postOfficeBox";
+ public static final String ADDRESS_BUILDING = "address.building";
+ public static final String ADDRESS_DEPARTMENT_NUMBER = "address.departmentNumber";
+ public static final String ADDRESS_ROOM_NUMBER = "address.roomNumber";
+ public static final String TEMPORAL_CONSTRAINTS_LABEL = "temporalConstraintsLabel";
+ public static final String BEGIN_TIME_P = "beginTimeP";
+ public static final String END_TIME_P = "endTimeP";
+ public static final String BEGIN_DATE_P = "beginDateP";
+ public static final String END_DATE_P = "endDateP";
+ public static final String BEGIN_LOCK_DATE_P = "beginLockDateP";
+ public static final String END_LOCK_DATE_P = "endLockDateP";
+ public static final String TIMEOUT_P = "timeoutP";
+ public static final String SUNDAY_P = "sundayP";
+ public static final String MONDAY_P = "mondayP";
+ public static final String TUESDAY_P = "tuesdayP";
+ public static final String WEDNESDAY_P = "wednesdayP";
+ public static final String THURSDAY_P = "thursdayP";
+ public static final String FRIDAY_P = "fridayP";
+ public static final String SATURDAY_P = "saturdayP";
+ public static final String SYSTEM_INFO_LABEL = "systemInfoLabel";
+ public static final String SYSTEM = "system";
+ public static final String CN = "cn";
+ public static final String SN = "sn";
+ public static final String IMPORT_PHOTO_LABEL = "importPhotoLabel";
+ public static final String SAVE = "save";
+ public static final String NAME = "name";
+ public static final String USER_ID = "userId";
+ public static final String PSWD_FIELD = "pswdField";
+ public static final String LOGIN = "login";
+ public static final String EMPLOYEE_TYPE = "employeeType";
+ public static final String TITLE = "title";
+ public static final String GROUP_PAGE = "groups";
+ public static final String AUDIT_AUTHZS_PAGE = "authzs";
+ public static final String AUDIT_MODS_PAGE = "mods";
+ public static final String AUDIT_BINDS_PAGE = "binds";
+ public static final String JPEGPHOTO = "jpegPhoto";
+ public static final String OU = "ou";
+ public static final String REQ_AUTHZ_ID = "reqAuthzID";
+ public static final String REQ_DN = "reqDN";
+ public static final String REQ_RESULT = "reqResult";
+ public static final String REQ_START = "reqStart";
+ public static final String REQ_ATTR = "reqAttr";
+ public static final String REQ_ATTRS_ONLY = "reqAttrsOnly";
+ public static final String REQ_DEREF_ALIASES = "reqDerefAliases";
+ public static final String AUTHZ_SUCCESS_CODE = "6";
+ public static final String BIND_SUCCESS_CODE = "0";
+ public static final String SUCCESS = "SUCCESS";
+ public static final String FAILURE = "FAILURE";
+ public static final String AUDIT_TIMESTAMP_FORMAT = "MM/dd/yyyy HH:mm:ss";
+ public static final String FIND_USERS = "findUsers";
+ public static final String FIND_PERMISSIONS = "findPermissions";
+ public static final String ONBLUR = "onblur";
+ public static final String ADDRESS_ADDRESSES = "address.addresses";
+ public static final String FT_MOD_ID = "ftModId";
+ public static final String FT_MODIFIER = "ftModifier";
+ public static final String FT_MOD_CODE = "ftModCode";
+
+ public static final String OBJ_NAME = "objName";
+ public static final String OP_NAME = "opName";
+ public static final String FAILED_ONLY = "failedOnly";
+ public static final String ADMIN = "admin";
+ public static final String GET_USER_AUTHZS = "getUserAuthZs";
+ public static final String GET_USER_BINDS = "searchBinds";
+ public static final String OBJECT_ID = "objId";
+ public static final String USERS_PAGE = "users";
+ public static final String ROLES_PAGE = "roles";
+ public static final String ADMROLES_PAGE = "admroles";
+ public static final String POBJS_PAGE = "pobjs";
+ public static final String ADMPERMS_PAGE = "admperms";
+ public static final String PERMS_PAGE = "perms";
+ public static final String PWPOLICIES_PAGE = "pwpolicies";
+ public static final String SSDS_PAGE = "ssds";
+ public static final String DSDS_PAGE = "dsds";
+ public static final String USEROUS_PAGE = "userous";
+ public static final String PERMOUS_PAGE = "permous";
+ public static final String ADMPOBJS_PAGE = "admpobjs";
+ public static final String WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML = "window.location.replace(\"/fortress-web/home.html\");";
+
+ public static final String WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE = "Wicket.Window.unloadConfirmation = false;";
+ public static final String ADD_USER = "addUser";
+ public static final String UPDATE_USER = "updateUser";
+ public static final String DELETE_USER = "deleteUser";
+ public static final String DEASSIGN = "deassign";
+ public static final String DEASSIGN_USER = "deassignUser";
+ public static final String NAVPANEL = "navpanel";
+ public static final String INFOPANEL = "infopanel";
+ public static final String OBJECTLISTPANEL = "objectlistpanel";
+ public static final String OBJECTDETAILPANEL = "objectdetailpanel";
+ public static final String OULISTPANEL = "oulistpanel";
+ public static final String OUDETAILPANEL = "oudetailpanel";
+ public static final String PERMLISTPANEL = "permlistpanel";
+ public static final String PERMDETAILPANEL = "permdetailpanel";
+ public static final String ROLELISTPANEL = "rolelistpanel";
+ public static final String ROLEDETAILPANEL = "roledetailpanel";
+ public static final String SDLISTPANEL = "sdlistpanel";
+ public static final String SDDETAILPANEL = "sddetailpanel";
+ public static final String GROUPLISTPANEL = "grouplistpanel";
+ public static final String GROUPDETAILPANEL = "groupdetailpanel";
+ public static final String LAYOUT = "layout";
+ public static final String PAGE_HEADER = "pageHeader";
+ public static final String DETAIL_FIELDS = "detailFields";
+ public static final String EDIT_FIELDS = "editFields";
+ public static final String USERAUDITDETAILPANEL = "userauditdetailpanel";
+ public static final String BEGIN_DATE = "beginDate";
+ public static final String END_DATE = "endDate";
+
+ public static final String FIND_ROLES = "findRoles";
+ public static final String ROLEAUXPANEL = "roleauxpanel";
+ public static final String ADD_ROLE = "addRole";
+ public static final String UPDATE_ROLE = "updateRole";
+ public static final String DELETE_ROLE = "deleteRole";
+ public static final String PARENTS = "parents";
+ public static final String OS_P = "osP";
+ public static final String OS_U = "osU";
+ public static final String BEGIN_RANGE = "beginRange";
+ public static final String BEGIN_INCLUSIVE = "beginInclusive";
+ public static final String END_RANGE = "endRange";
+ public static final String END_INCLUSIVE = "endInclusive";
+ public static final String PERMOU_SEARCH = "permou.search";
+ public static final String USEROU_SEARCH = "userou.search";
+ public static final String BEGIN_RANGE_SEARCH = "beginRange.search";
+ public static final String END_RANGE_SEARCH = "endRange.search";
+ public static final String PARENTROLES_SEARCH = "parentroles.search";
+ public static final String POLICY_SEARCH = "policy.search";
+ public static final String OU_SEARCH = "ou.search";
+ public static final String ROLES_SEARCH = "roles.search";
+ public static final String FIELD_2 = "field2";
+ public static final String FIELD_1 = "field1";
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
new file mode 100644
index 0000000..70991f4
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
@@ -0,0 +1,56 @@
+/*
+ * 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.control;
+
+
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+
+
+/**
+ * This link requires the id format be: objname.operationname
+ * where name maps to ft perm obj name and op maps to ft perm op name.
+ * If match not found link will quietly not display the link on page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class FtBookmarkablePageLink extends BookmarkablePageLink
+{
+ private static final Logger LOG = Logger.getLogger( FtBookmarkablePageLink.class.getName() );
+ Permission perm;
+
+ public <C extends Page> FtBookmarkablePageLink( String id, Class<C> pageClass )
+ {
+ super( id, pageClass );
+ perm = SecUtils.getPermFromId( id );
+ if ( perm != null && SecUtils.isFound( perm, this ) )
+ {
+ LOG.debug( "FtBookmarkablePageLink id: " + id + ", status found" );
+ }
+ else
+ {
+ LOG.debug( "FtBookmarkablePageLink id: " + id + ", status NOT found" );
+ setVisible( false );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
new file mode 100644
index 0000000..35e61cd
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
@@ -0,0 +1,105 @@
+/*
+ * 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.control;
+
+import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
+import org.apache.log4j.Logger;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class FtIndicatingAjaxButton extends IndicatingAjaxButton
+{
+ Permission perm;
+
+ @SpringBean
+ private AccessMgr accessMgr;
+
+ private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
+
+ public FtIndicatingAjaxButton(String id)
+ {
+ super( id );
+ String[] parts = id.split( "\\." );
+ if(parts != null && parts.length > 1)
+ {
+ String objName = parts[0];
+ String opName = parts[1];
+ this.perm = new Permission(objName, opName);
+ if ( SecUtils.isFound( perm, this ) )
+ {
+ LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status found" );
+ }
+ else
+ {
+ LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status NOT found" );
+ setVisible( false );
+ }
+
+ }
+ else
+ {
+ throw new RuntimeException( "FtIndicatingAjaxButton Constructor ID: " + id + ", requires objectname.opname format" );
+ }
+ }
+
+ protected boolean checkAccess( )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+
+ protected boolean checkAccess( String objectId )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
+ isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
new file mode 100644
index 0000000..2988571
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
@@ -0,0 +1,403 @@
+/*
+ * 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.control;
+
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.cfg.Config;
+import org.apache.directory.fortress.core.rbac.UserRole;
+import org.apache.directory.fortress.core.rbac.Warning;
+import org.apache.directory.fortress.realm.*;
+import org.apache.directory.fortress.realm.GlobalIds;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Component;
+import org.apache.directory.fortress.core.rbac.Permission;
+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.wicket.ajax.AjaxRequestTarget;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+import java.util.List;
+
+/**
+ * Common static utils and wrappers used by Wicket web apps to make fortress style security calls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecUtils
+{
+ private static final Logger LOG = Logger.getLogger( SecUtils.class.getName() );
+ private static final String PERMS_CACHED = "perms.cached";
+ public static final boolean IS_PERM_CACHED = ( ( Config.getProperty( PERMS_CACHED ) != null ) && ( Config
+ .getProperty( PERMS_CACHED ).equalsIgnoreCase( "true" ) ) );
+
+ /**
+ * Return the fortress session that is cached within the wicket session object.
+ *
+ * @param component needed to get handle to wicket session.
+ * @return fortress session object.
+ */
+ public static Session getSession(Component component)
+ {
+ return ( ( WicketSession ) component.getSession() ).getSession();
+ }
+
+ /**
+ * Used when web app needs to create a 'trusted' fortress session.
+ *
+ * Does not check user's password.
+ *
+ * @param accessMgr fortress access mgr apis
+ * @param userId required for rbac session creation.
+ * @return rbac session.
+ */
+ public static Session createSession(AccessMgr accessMgr, String userId)
+ {
+ Session session;
+ try
+ {
+ // Create an RBAC session and attach to Wicket session:
+ session = accessMgr.createSession( new User( userId ), true );
+ String message = "RBAC Session successfully created for userId: " + session.getUserId();
+ LOG.debug( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "createSession caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ return session;
+ }
+
+ /**
+ * Here the wicket session is loaded with the fortress session and permissions.
+ *
+ *
+ * @param delAccessMgr needed to pull back fortress arbac permissions.
+ * @param session needed for call into accessMgr.
+ */
+ public static void loadPermissionsIntoSession( DelAccessMgr delAccessMgr, Session session)
+ {
+ try
+ {
+ // Retrieve user permissions and attach fortress session to Wicket session:
+ ( ( WicketSession ) WicketSession.get() ).setSession( session );
+ List<Permission> permissions = delAccessMgr.sessionPermissions( session );
+ ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
+ String message = "Session successfully created for userId: " + session.getUserId();
+ LOG.debug( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "loadPermissionsIntoSession caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ }
+
+ /**
+ * Returns the fortress arbac perms that are cashed in the wicket session.
+ *
+ * @param component needed to get a handle on the wicket session object.
+ * @return collection of fortress admin perms.
+ */
+ public static List<Permission> getPermissions(Component component)
+ {
+ return ( ( WicketSession ) component.getSession() ).getPermissions();
+ }
+
+ /**
+ * Retrieve RBAC session permissions from Fortress and place in the Wicket session.
+ */
+ public static void getPermissions( Component component, AccessMgr accessMgr )
+ {
+ try
+ {
+ if ( IS_PERM_CACHED )
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ List<Permission> permissions = accessMgr.sessionPermissions( session.getSession() );
+ ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
+ }
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "getPermissions caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ }
+
+ /**
+ * Wrapper for the httpservlet isUserInRole api.
+ *
+ * @param roleName contains the name of role being checked.
+ * @param servletReq handle used to make inquiry.
+ * @return true if authorized, false otherwise.
+ */
+ public static boolean isAuthorized( String roleName, HttpServletRequest servletReq )
+ {
+ boolean isAuthorized = false;
+ if ( servletReq.isUserInRole( roleName ) )
+ {
+ isAuthorized = true;
+ }
+ return isAuthorized;
+ }
+
+ /**
+ * Is the supplied permission in the wicket session cache? Called by buttons.
+ * if not found, button will be invisible.
+ *
+ * @param permission fortress perm requires {link @Permission#objName} and {link @Permission#opName} are set.
+ * @param component needed to get handle on the wicket session object.
+ * @return true if found, false otherwise
+ */
+ public static boolean isFound( Permission permission, Component component )
+ {
+ List<Permission> permissions = SecUtils.getPermissions( component );
+ return VUtil.isNotNullOrEmpty( permissions ) && permissions.contains( permission );
+ }
+
+ /**
+ * Wrapper to fortress checkAccess api.
+ *
+ * @param component contains the wicket session handle.
+ * @param accessMgr has the checkAccess api
+ * @param objName string value
+ * @param opName string value
+ * @param objId string value
+ * @return true if success, false otherwise.
+ * @throws org.apache.directory.fortress.core.SecurityException checked exception for system errors.
+ */
+ public static boolean checkAccess(Component component, AccessMgr accessMgr, String objName, String opName, String objId ) throws org.apache.directory.fortress.core.SecurityException
+ {
+ WicketSession session = ( WicketSession )component.getSession();
+ Permission permission = new Permission( objName, opName, objId );
+ return accessMgr.checkAccess( session.getSession(), permission );
+ }
+
+ /**
+ * Convert the principal into fortress session and load into wicket session along with perms.
+ *
+ * @param component contains handle to wicket session.
+ * @param j2eePolicyMgr used to call deserize api
+ * @param accessMgr used to call fortress api for role op
+ * @param szPrincipal contains the instance of fortress session deserialized.
+ */
+ public static void initializeSession(Component component, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr, String szPrincipal ) throws SecurityException
+ {
+ Session realmSession = null;
+
+ if(j2eePolicyMgr == null || accessMgr == null)
+ {
+ throw new SecurityException( GlobalIds.SESSION_INITIALIZATION_FAILED, "initializeSession failed - verify the injection of fortress spring beans into your application" );
+ }
+ try
+ {
+ if(VUtil.isNotNullOrEmpty( szPrincipal ))
+ realmSession = j2eePolicyMgr.deserialize( szPrincipal );
+ }
+ catch( SecurityException se )
+ {
+ throw new RuntimeException( se );
+ }
+ if(realmSession != null)
+ {
+ synchronized ( ( WicketSession ) WicketSession.get() )
+ {
+ if ( SecUtils.getSession( component ) == null )
+ {
+ LOG.info( "realmSession user: " + realmSession.getUserId() );
+ // Retrieve user permissions and attach RBAC session to Wicket session:
+ ( ( WicketSession ) WicketSession.get() ).setSession( realmSession );
+ getPermissions( component, accessMgr );
+ }
+ }
+ }
+ }
+
+ /**
+ * Call RBAC addActiveRole to activate a new role into user's session.
+ * This routine must first retrieves the wicket session.
+ * It is needed because it contains the fortress session which is required for api.
+ * Next it invokes the fortress addActiveRole method.
+ * If all successful refresh user's perms cached as they've changed.
+ *
+ * @param component contains handle to wicket session.
+ * @param target used to display modal if something goes wrong
+ * @param accessMgr used to call fortress api for role op
+ * @param roleName contains the role name target
+ * @return true if success, false otherwise.
+ */
+ public static boolean addActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
+ {
+ boolean isSuccessful = false;
+ try
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ session.getSession().setWarnings( null );
+ accessMgr.addActiveRole( session.getSession(), new UserRole( roleName ) );
+ List<Warning> warnings = session.getSession().getWarnings();
+ if ( VUtil.isNotNullOrEmpty( warnings ) )
+ {
+ for ( Warning warning : warnings )
+ {
+ LOG.info( "Warning: " + warning.getMsg() + " errCode: " + warning.getId() + " name: " + warning
+ .getName() + " type: " + warning.getType().toString() );
+ if ( warning.getType() == Warning.Type.ROLE && warning.getName().equalsIgnoreCase( roleName ) )
+ {
+ String error = warning.getMsg() + " code: " + warning.getId();
+ LOG.error( error );
+ target.appendJavaScript( ";alert('" + error + "');" );
+ return false;
+ }
+ }
+ }
+
+ // User's active role set changed so refresh their permissions:
+ SecUtils.getPermissions( component, accessMgr );
+ isSuccessful = true;
+ String message = "Activate role name: " + roleName + " successful";
+ LOG.info( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String msg = "Role selection " + roleName + " activation failed because of ";
+ if ( se.getErrorId() == GlobalErrIds.DSD_VALIDATION_FAILED )
+ {
+ msg += "Dynamic SoD rule violation";
+ }
+ else if ( se.getErrorId() == GlobalErrIds.URLE_ALREADY_ACTIVE )
+ {
+ msg += "Role already active in Session";
+ }
+ else
+ {
+ msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
+ }
+ LOG.error( msg );
+ target.appendJavaScript( ";alert('" + msg + "');" );
+ }
+ return isSuccessful;
+ }
+
+ /**
+ * Call RBAC dropActiveRole to deactivate a new role from user's session.
+ * This routine must first retrieves the wicket session.
+ * It is needed because it contains the fortress session which is required for api.
+ * Next it invokes the fortress dropActiveRole method.
+ * If all successful refresh user's perms cached as they've changed.
+ *
+ * @param component contains handle to wicket session.
+ * @param target used to display modal if something goes wrong
+ * @param accessMgr used to call fortress api for role op
+ * @param roleName contains the role name target
+ * @return true if success, false otherwise.
+ */
+ public static boolean dropActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
+ {
+ boolean isSuccessful = false;
+ try
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ accessMgr.dropActiveRole( session.getSession(), new UserRole( roleName ) );
+ // User's active role set changed so refresh their permissions:
+ SecUtils.getPermissions( component, accessMgr );
+ isSuccessful = true;
+ LOG.info( "Fortress dropActiveRole roleName: " + roleName + " was successful" );
+ }
+ catch ( SecurityException se )
+ {
+ String msg = "Role selection " + roleName + " deactivation failed because of ";
+ if ( se.getErrorId() == GlobalErrIds.URLE_NOT_ACTIVE )
+ {
+ msg += "Role not active in session";
+ }
+ else
+ {
+ msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
+ }
+ LOG.error( msg );
+ target.appendJavaScript( ";alert('" + msg + "');" );
+ }
+ return isSuccessful;
+ }
+
+ /**
+ * Enables fortress session on behalf of a java.security.Principal retrieved from the container.
+ *
+ * @param component
+ * @param servletReq
+ * @param j2eePolicyMgr
+ * @param accessMgr
+ * @throws SecurityException
+ */
+ public static void enableFortress( Component component, HttpServletRequest servletReq, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr ) throws SecurityException
+ {
+ // Get the principal from the container:
+ Principal principal = servletReq.getUserPrincipal();
+ // Is this a Java EE secured page && has the User successfully authenticated already?
+ boolean isSecured = principal != null;
+ if(isSecured)
+ {
+ //linksLabel += " for " + principal.getName();
+ if( !isLoggedIn( component ) )
+ {
+ String szPrincipal = principal.toString();
+ // Pull the fortress session from the realm and assert into the Web app's session along with user's perms:
+ SecUtils.initializeSession( component, j2eePolicyMgr, accessMgr, szPrincipal );
+ }
+ }
+ }
+
+ /**
+ * If user has a wicket session then considered logged in.
+ *
+ * @return true if wicket session is not null
+ */
+ public static boolean isLoggedIn( Component component )
+ {
+ boolean isLoggedIn = false;
+ if ( getSession( component ) != null )
+ {
+ isLoggedIn = true;
+ }
+ return isLoggedIn;
+ }
+
+ public static Permission getPermFromId( String id )
+ {
+ Permission perm = null;
+ String[] parts = id.split( "\\." );
+ if(parts != null && parts.length > 1)
+ {
+ String objName = parts[0];
+ String opName = parts[1];
+ perm = new Permission( objName, opName );
+ }
+ return perm;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
new file mode 100644
index 0000000..9f73d6c
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
@@ -0,0 +1,78 @@
+/*
+ * 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.control;
+
+
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.StringTokenizer;
+
+
+/**
+ * ...
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecureBookmarkablePageLink extends BookmarkablePageLink
+{
+ public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, String roleName )
+ {
+ super( id, pageClass );
+ if(!isAuthorized( roleName ))
+ {
+ setVisible( false );
+ }
+ }
+
+ public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, PageParameters parameters,
+ String roleName )
+ {
+ super( id, pageClass, parameters );
+ if ( !isAuthorized( roleName ) )
+ {
+ setVisible( false );
+ }
+ }
+
+ private boolean isAuthorized( String roleName )
+ {
+ HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
+ return isAuthorized( roleName, servletReq );
+ }
+
+ private boolean isAuthorized( String roleNames, HttpServletRequest servletReq )
+ {
+ boolean isAuthorized = false;
+ StringTokenizer tokenizer = new StringTokenizer( roleNames, "," );
+ if (tokenizer.countTokens() > 0)
+ {
+ while (tokenizer.hasMoreTokens())
+ {
+ String roleName = tokenizer.nextToken();
+ isAuthorized = SecUtils.isAuthorized( roleName, servletReq );
+ }
+ }
+ return isAuthorized;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java
new file mode 100644
index 0000000..419cb20
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.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.control;
+
+import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Component;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class SecureIndicatingAjaxButton extends IndicatingAjaxButton
+{
+ Permission perm;
+
+ @SpringBean
+ private AccessMgr accessMgr;
+
+ private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
+
+ public SecureIndicatingAjaxButton( Component component, String id, String objectName, String opName )
+ {
+ super( id );
+ this.perm = new Permission(objectName, opName);
+ if( SecUtils.IS_PERM_CACHED)
+ {
+ if(!SecUtils.isFound( perm, this ))
+ setVisible( false );
+ }
+ else
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )component.getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objectName: " + objectName + " operationName: " + opName + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + objectName + " operationName: " + opName + " error=" + se;
+ LOG.error( error );
+ }
+ if(!isAuthorized)
+ setVisible( false );
+ }
+ }
+
+ public SecureIndicatingAjaxButton( String id, String roleName )
+ {
+ super( id );
+ HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
+ if( ! SecUtils.isAuthorized( roleName, servletReq ) )
+ setVisible( false );
+ }
+
+ public SecureIndicatingAjaxButton( String id, String objName, String opName )
+ {
+ super( id );
+ if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
+ setVisible( false );
+ }
+
+ protected boolean checkAccess( String objectName, String opName )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission permission = new Permission( objectName, opName );
+ //Permission permission = new Permission( objectName, perm.getOpName() );
+ isAuthorized = accessMgr.checkAccess( session.getSession(), permission );
+ LOG.info( "Fortress checkAccess objectName: " + permission.getObjName() + " operationName: " + permission.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " operationName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+ protected boolean checkAccess( )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+
+ protected boolean checkAccess( String objectId )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
+ isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
new file mode 100644
index 0000000..c978610
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
@@ -0,0 +1,53 @@
+/*
+ * 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.control;
+
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+
+/**
+ * ...
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecureIndicatingAjaxLink extends IndicatingAjaxLink
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+
+ public SecureIndicatingAjaxLink( String id, String objName, String opName )
+ {
+ super( id );
+ if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
+ setEnabled( false );
+ }
+
+
+ @Override
+ public void onClick( AjaxRequestTarget target )
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
new file mode 100644
index 0000000..03fe3b9
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
@@ -0,0 +1,80 @@
+/*
+ * 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.control;
+
+
+import org.apache.wicket.protocol.http.WebSession;
+import org.apache.wicket.request.Request;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Session;
+
+import java.util.List;
+
+
+/**
+ * This object is managed by wicket framework. It is used to cache a copy of a user's session and permissions.
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class WicketSession extends WebSession
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+ private Session session;
+ private List<Permission> permissions;
+
+
+ /**
+ * Constructor. Note that {@link org.apache.wicket.request.cycle.RequestCycle} is not available until this
+ * constructor returns.
+ *
+ * @param request The current request
+ */
+ public WicketSession(Request request)
+ {
+ super( request );
+ }
+
+
+ public Session getSession()
+ {
+ return session;
+ }
+
+
+ public void setSession(Session session)
+ {
+ this.session = session;
+ }
+
+
+ public List<Permission> getPermissions()
+ {
+ return permissions;
+ }
+
+
+ public void setPermissions( List<Permission> permissions )
+ {
+ this.permissions = permissions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
new file mode 100644
index 0000000..12e5701
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
@@ -0,0 +1,43 @@
+/*
+ * 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.event;
+
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AjaxUpdateEvent
+{
+
+ private final AjaxRequestTarget target;
+
+ public AjaxUpdateEvent(AjaxRequestTarget target)
+ {
+ this.target = target;
+ }
+
+ public AjaxRequestTarget getAjaxRequestTarget()
+ {
+ return target;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
new file mode 100644
index 0000000..1033187
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
@@ -0,0 +1,235 @@
+/*
+ * 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.event;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.request.ILogData;
+import org.apache.wicket.request.IRequestCycle;
+import org.apache.wicket.request.component.IRequestablePage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.core.rbac.FortEntity;
+
+import java.util.Collection;
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SaveModelEvent extends AjaxUpdateEvent
+{
+ private int index = 0;
+ private FortEntity entity;
+
+ public Operations getOperation()
+ {
+ return operation;
+ }
+
+ public void setOperation(Operations operation)
+ {
+ this.operation = operation;
+ }
+
+ private Operations operation;
+
+ public enum Operations
+ {
+ ADD,
+ UPDATE,
+ SEARCH,
+ DELETE
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target)
+ {
+ super(target);
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, int index)
+ {
+ super(target);
+ this.index = index;
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, FortEntity entity)
+ {
+ super(target);
+ this.entity = entity;
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, FortEntity entity, Operations operation)
+ {
+ super(target);
+ this.entity = entity;
+ this.operation = operation;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public FortEntity getEntity()
+ {
+ return entity;
+ }
+
+ public void setEntity(FortEntity entity)
+ {
+ this.entity = entity;
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target, Operations operation)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity, operation));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity)
+ {
+ AjaxRequestTarget target = new AjaxRequestTarget()
+ {
+ @Override
+ public void add(Component component, String markupId)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ //component.
+ }
+ @Override
+ public void add(Component... components)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addChildren(MarkupContainer parent, Class<?> childCriteria)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addListener(IListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void appendJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void prependJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void registerRespondListener(ITargetRespondListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Collection<? extends Component> getComponents()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void focusComponent(Component component)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public IHeaderResponse getHeaderResponse()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public String getLastFocusedElementId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Page getPage()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public ILogData getLogData()
+
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getPageId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public boolean isPageInstanceCreated()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getRenderCount()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Class<? extends IRequestablePage> getPageClass()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public PageParameters getPageParameters()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void respond(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void detach(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ };
+/*
+ //AjaxRequestTarget target = AjaxRequestTarget.get();
+ if (target != null) { //...then this is an ajax request, not a static one
+ target.addComponent(myComponent);
+ }
+*/
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
new file mode 100644
index 0000000..8f02b51
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
@@ -0,0 +1,196 @@
+/*
+ * 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.event;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.request.ILogData;
+import org.apache.wicket.request.IRequestCycle;
+import org.apache.wicket.request.component.IRequestablePage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.core.rbac.FortEntity;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SelectModelEvent extends AjaxUpdateEvent
+{
+ private int index = 0;
+ private FortEntity entity;
+
+ public SelectModelEvent(AjaxRequestTarget target)
+ {
+ super(target);
+ }
+
+ public SelectModelEvent(AjaxRequestTarget target, int index)
+ {
+ super(target);
+ this.index = index;
+ }
+
+ public SelectModelEvent(AjaxRequestTarget target, FortEntity entity)
+ {
+ super(target);
+ this.entity = entity;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public FortEntity getEntity()
+ {
+ return entity;
+ }
+
+ public void setEntity(FortEntity entity)
+ {
+ this.entity = entity;
+ }
+
+ public static void send(Page page, Component component, FortEntity entity)
+ {
+ AjaxRequestTarget target = new AjaxRequestTarget()
+ {
+ @Override
+ public void add(Component component, String markupId)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ //component.
+ }
+ @Override
+ public void add(Component... components)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addChildren(MarkupContainer parent, Class<?> childCriteria)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addListener(IListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void appendJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void prependJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void registerRespondListener(ITargetRespondListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Collection<? extends Component> getComponents()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void focusComponent(Component component)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public IHeaderResponse getHeaderResponse()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public String getLastFocusedElementId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Page getPage()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public ILogData getLogData()
+
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getPageId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public boolean isPageInstanceCreated()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getRenderCount()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Class<? extends IRequestablePage> getPageClass()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public PageParameters getPageParameters()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void respond(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void detach(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ };
+ component.send(page, Broadcast.BREADTH, new SelectModelEvent(target, entity));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+}
\ No newline at end of file