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 2014/11/11 21:35:35 UTC
[25/27] directory-fortress-commander git commit: change package
structure and names, pom improvements, license
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..63c3dde
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/ObjectPage.java
@@ -0,0 +1,76 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.ObjectDetailPanel;
+import org.apache.directory.fortress.web.panel.ObjectListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class ObjectPage extends FortressWebBasePage
+{
+ private boolean isAdmin = false;
+ private String label = "RBAC Permission Object Page";
+ public ObjectPage(PageParameters parameters)
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel(GlobalIds.OBJECTLISTPANEL)
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new ObjectListPanel( id, isAdmin );
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ ObjectDetailPanel objectDetail = new ObjectDetailPanel( GlobalIds.OBJECTDETAILPANEL, display, isAdmin );
+ container.add(objectDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..b825b3b
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/OuPermPage.java
@@ -0,0 +1,75 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.OUDetailPanel;
+import org.apache.directory.fortress.web.panel.OUListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class OuPermPage extends FortressWebBasePage
+{
+ private boolean isUser = false;
+ private String label = "Permission Organizational Unit Administration";
+ public OuPermPage(PageParameters parameters)
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel( GlobalIds.OULISTPANEL )
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new OUListPanel(id, isUser);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ OUDetailPanel ouDetail = new OUDetailPanel(GlobalIds.OUDETAILPANEL, display, isUser);
+ container.add(ouDetail);
+ container.add(navPanel);
+ this.add(container);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..070de62
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/OuUserPage.java
@@ -0,0 +1,75 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.OUDetailPanel;
+import org.apache.directory.fortress.web.panel.OUListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class OuUserPage extends FortressWebBasePage
+{
+ private boolean isUser = true;
+ private String label = "User Organizational Unit Administration";
+ public OuUserPage( PageParameters parameters )
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel(GlobalIds.OULISTPANEL)
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new OUListPanel(id, isUser);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ OUDetailPanel ouDetail = new OUDetailPanel( GlobalIds.OUDETAILPANEL, display, isUser);
+ container.add(ouDetail);
+ container.add(navPanel);
+ this.add(container);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..7adf213
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/PermAdminPage.java
@@ -0,0 +1,77 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.PermDetailPanel;
+import org.apache.directory.fortress.web.panel.PermListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class PermAdminPage extends FortressWebBasePage
+{
+ private boolean isAdmin = true;
+ private String label = "Administrative Permission Operation Page";
+
+ public PermAdminPage(PageParameters parameters)
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel( GlobalIds.PERMLISTPANEL )
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new PermListPanel(id, isAdmin);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ PermDetailPanel permDetail = new PermDetailPanel( GlobalIds.PERMDETAILPANEL, display, isAdmin );
+ container.add(permDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..9668ca0
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/PermListModel.java
@@ -0,0 +1,129 @@
+/*
+ * 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.Permission;
+import org.apache.directory.fortress.core.rbac.Role;
+import org.apache.directory.fortress.core.rbac.Session;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param <T>
+ */
+public class PermListModel<T extends Serializable> extends Model
+{
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger log = Logger.getLogger(PermListModel.class.getName());
+ private transient Permission perm;
+ private transient List<Permission> perms = null;
+ private boolean isAdmin;
+
+ public PermListModel(final boolean isAdmin, final Session session )
+ {
+ Injector.get().inject(this);
+ this.isAdmin = isAdmin;
+ this.reviewMgr.setAdmin( session );
+ }
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param perm
+ */
+ public PermListModel(Permission perm, final boolean isAdmin, final Session session )
+ {
+ Injector.get().inject(this);
+ this.isAdmin = isAdmin;
+ this.perm = perm;
+ this.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 T getObject()
+ {
+ if (perms != null)
+ {
+ log.debug(".getObject count: " + perms != null ? perms.size() : "null");
+ return (T) perms;
+ }
+ if (perm == null)
+ {
+ log.debug(".getObject null");
+ perms = new ArrayList<Permission>();
+ }
+ else
+ {
+ log.debug(" .getObject perm objectNm: " + perm != null ? perm.getObjName() : "null");
+ log.debug(" .getObject perm opNm: " + perm != null ? perm.getOpName() : "null");
+ perms = getList(perm);
+ }
+ return (T) perms;
+ }
+
+ @Override
+ public void setObject(Object object)
+ {
+ log.debug(".setObject count: " + perms != null ? ((List<Role>)object).size() : "null");
+ this.perms = (List<Permission>) object;
+ }
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.perms = null;
+ this.perm = null;
+ }
+
+ private List<Permission> getList(Permission perm)
+ {
+ List<Permission> permsList = null;
+ try
+ {
+ String szObjectNm = perm != null ? perm.getObjName() : "";
+ String szOpNm = perm != null ? perm.getOpName() : "";
+ log.debug(".getList objectNm: " + szObjectNm + " opNm: " + szOpNm);
+ perm.setAdmin( isAdmin );
+ permsList = reviewMgr.findPermissions(perm);
+ }
+ catch (org.apache.directory.fortress.core.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/547b9ccd/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
new file mode 100644
index 0000000..c2e8bce
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/PermPage.java
@@ -0,0 +1,77 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.PermDetailPanel;
+import org.apache.directory.fortress.web.panel.PermListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class PermPage extends FortressWebBasePage
+{
+ private boolean isAdmin = false;
+ private String label = "RBAC Permission Operation Page";
+
+ public PermPage(PageParameters parameters)
+ {
+ add(new Label( GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel(GlobalIds.PERMLISTPANEL)
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new PermListPanel(id, isAdmin);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ PermDetailPanel permDetail = new PermDetailPanel( GlobalIds.PERMDETAILPANEL, display, isAdmin );
+ container.add(permDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..157ffa7
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/PwPolicyListModel.java
@@ -0,0 +1,127 @@
+/*
+ * 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.PwPolicyMgr;
+import org.apache.directory.fortress.core.rbac.PwPolicy;
+import org.apache.directory.fortress.core.rbac.Session;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param <T>
+ */
+public class PwPolicyListModel<T extends Serializable> extends Model
+{
+ @SpringBean
+ private PwPolicyMgr pwPolicyMgr;
+ private static final Logger log = Logger.getLogger(PwPolicyListModel.class.getName());
+ private transient PwPolicy policy;
+ private transient List<PwPolicy> policies = null;
+
+ /**
+ * Default constructor
+ */
+ public PwPolicyListModel( final 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, final 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 T getObject()
+ {
+ if (policies != null)
+ {
+ log.debug(".getObject count: " + policy != null ? policies.size() : "null");
+ return (T) policies;
+ }
+ if (policy == null)
+ {
+ log.debug(".getObject null");
+ policies = new ArrayList<PwPolicy>();
+ }
+ else
+ {
+ log.debug(".getObject policyNm: " + policy != null ? policy.getName() : "null");
+ policies = getList(policy);
+ }
+ return (T) policies;
+ }
+
+ @Override
+ public void setObject(Object object)
+ {
+ log.debug(".setObject count: " + object != null ? ((List<PwPolicy>)object).size() : "null");
+ this.policies = (List<PwPolicy>) object;
+ }
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.policies = null;
+ this.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);
+ }
+ catch (org.apache.directory.fortress.core.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/547b9ccd/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
new file mode 100644
index 0000000..fe5f243
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/PwPolicyPage.java
@@ -0,0 +1,74 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.PwPolicyDetailPanel;
+import org.apache.directory.fortress.web.panel.PwPolicyListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * Date: 6/12/13
+ */
+public class PwPolicyPage extends FortressWebBasePage
+{
+ public PwPolicyPage()
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, "Password Policy Administration"));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter("72", "28");
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail.
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel("policylistpanel")
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new PwPolicyListPanel(id);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ PwPolicyDetailPanel policyDetail = new PwPolicyDetailPanel("policydetailpanel", display);
+ container.add(policyDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/src/main/java/org/apache/directory/fortress/web/RbacSession.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/RbacSession.java b/src/main/java/org/apache/directory/fortress/web/RbacSession.java
new file mode 100644
index 0000000..c3db301
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/RbacSession.java
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class RbacSession extends WebSession
+{
+ 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 RbacSession( Request request )
+ {
+ super( request );
+ }
+
+ public Session getRbacSession()
+ {
+ 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/547b9ccd/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
new file mode 100644
index 0000000..e957a63
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/RoleAdminPage.java
@@ -0,0 +1,85 @@
+/*
+ * 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.Component;
+import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.RoleDetailPanel;
+import org.apache.directory.fortress.web.panel.RoleListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class RoleAdminPage extends FortressWebBasePage
+{
+ private boolean isAdmin = true;
+ private String label = "Admin Role Administration";
+ private static final Logger LOG = Logger.getLogger( RoleAdminPage.class.getName() );
+
+ /**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param parameters
+ */
+ public RoleAdminPage(PageParameters parameters)
+ {
+ String type = GlobalUtils.getPageType(parameters);
+ add( new Label( GlobalIds.PAGE_HEADER, label ) );
+ WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout( container );
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel( GlobalIds.NAVPANEL );
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel( GlobalIds.ROLELISTPANEL )
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new RoleListPanel(id, isAdmin);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel( GlobalIds.INFOPANEL );
+ container.add( infoPanel );
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ RoleDetailPanel roleDetail = new RoleDetailPanel( GlobalIds.ROLEDETAILPANEL, display, isAdmin );
+ container.add( roleDetail );
+
+ container.add( navPanel );
+ this.add( container );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..441fa63
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/RoleListModel.java
@@ -0,0 +1,153 @@
+/*
+ * 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.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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param <T>
+ */
+public class RoleListModel<T extends Serializable> extends Model
+{
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ @SpringBean
+ private DelReviewMgr delReviewMgr;
+ private static final Logger log = Logger.getLogger(RoleListModel.class.getName());
+ private transient T role;
+ private transient List<T> roles = null;
+ private boolean isAdmin;
+
+
+ public RoleListModel(final boolean isAdmin, final Session session )
+ {
+ Injector.get().inject(this);
+ this.isAdmin = isAdmin;
+ this.reviewMgr.setAdmin( session );
+ }
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param role
+ */
+ public RoleListModel(T role, final boolean isAdmin, final 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 T getObject()
+ {
+ if (roles != null)
+ {
+ log.debug(".getObject count: " + role != null ? roles.size() : "null");
+ return (T) roles;
+ }
+ if (role == null)
+ {
+ log.debug(".getObject null");
+ roles = new ArrayList<T>();
+ }
+ else
+ {
+ log.debug(".getObject roleNm: " + role != null ? ((Role)role).getName() : "null");
+ if(isAdmin)
+ {
+ roles = getAdminList( ( (AdminRole)role ).getName() );
+ }
+ else
+ {
+ roles = getList( ( (Role)role ).getName() );
+ }
+
+ }
+ return (T) roles;
+ }
+
+ @Override
+ public void setObject(Object object)
+ {
+ log.debug(".setObject count: " + object != null ? ((List<Role>)object).size() : "null");
+ this.roles = (List<T>) object;
+ }
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.roles = null;
+ this.role = null;
+ }
+
+ private List<T> getList(String szRoleNm)
+ {
+ List<T> rolesList = null;
+ try
+ {
+ log.debug(".getList roleNm: " + szRoleNm);
+ rolesList = (List<T>)reviewMgr.findRoles(szRoleNm);
+ }
+ catch (org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = ".getList caught SecurityException=" + se;
+ log.warn(error);
+ }
+ return rolesList;
+ }
+
+ private List<T> getAdminList(String szRoleNm)
+ {
+ List<T> rolesList = null;
+ try
+ {
+ log.debug(".getList roleNm: " + szRoleNm);
+ rolesList = (List<T>)delReviewMgr.findRoles(szRoleNm);
+ }
+ catch (org.apache.directory.fortress.core.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/547b9ccd/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
new file mode 100644
index 0000000..ff24e7d
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/RolePage.java
@@ -0,0 +1,79 @@
+/*
+ * 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.Component;
+import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.RoleDetailPanel;
+import org.apache.directory.fortress.web.panel.RoleListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class RolePage extends FortressWebBasePage
+{
+ private boolean isAdmin = false;
+ private String label = "RBAC Role Administration";
+ private static final Logger LOG = Logger.getLogger( RolePage.class.getName() );
+
+ public RolePage(PageParameters parameters)
+ {
+ add( new Label( GlobalIds.PAGE_HEADER, label ) );
+ WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout( container );
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel( GlobalIds.NAVPANEL );
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel(GlobalIds.ROLELISTPANEL)
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new RoleListPanel(id, isAdmin);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel( GlobalIds.INFOPANEL );
+ container.add( infoPanel );
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ RoleDetailPanel roleDetail = new RoleDetailPanel( GlobalIds.ROLEDETAILPANEL, display, isAdmin );
+ container.add( roleDetail );
+
+ container.add( navPanel );
+ this.add( container );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..fdd2813
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SDListModel.java
@@ -0,0 +1,147 @@
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param <T>
+ */
+public class SDListModel<T extends Serializable> extends Model
+{
+ @SpringBean
+ private ReviewMgr reviewMgr;
+ private static final Logger log = Logger.getLogger(SDListModel.class.getName());
+ private transient SDSet sdSet;
+ private transient List<SDSet> sdSets = null;
+
+ /**
+ * Default constructor
+ */
+ public SDListModel(boolean isStatic, final Session session )
+ {
+ Injector.get().inject(this);
+ 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;
+ this.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 T getObject()
+ {
+ if (sdSets != null)
+ {
+ log.debug(".getObject count: " + sdSet != null ? sdSets.size() : "null");
+ return (T) sdSets;
+ }
+ if (sdSet == null)
+ {
+ log.debug(".getObject null");
+ sdSets = new ArrayList<SDSet>();
+ }
+ else
+ {
+ log.debug(".getObject sdSetNm: " + sdSet != null ? sdSet.getName() : "null");
+ sdSets = getList(sdSet);
+ }
+ return (T) sdSets;
+ }
+
+ @Override
+ public void setObject(Object object)
+ {
+ log.debug(".setObject count: " + object != null ? ((List<SDSet>)object).size() : "null");
+ this.sdSets = (List<SDSet>) object;
+ }
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.sdSets = null;
+ this.sdSet = null;
+ }
+
+ private List<SDSet> getList(SDSet sdSet)
+ {
+ List<SDSet> sdSetList = null;
+ try
+ {
+ String szSdSetNm = sdSet != null && sdSet.getName() != null ? 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);
+ }
+ }
+ catch (org.apache.directory.fortress.core.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/547b9ccd/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
new file mode 100644
index 0000000..2601656
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/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;
+
+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 Shawn McKinney
+ * @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/547b9ccd/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
new file mode 100644
index 0000000..e69e64a
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SdDynamicPage.java
@@ -0,0 +1,77 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.SDDetailPanel;
+import org.apache.directory.fortress.web.panel.SDListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class SdDynamicPage extends FortressWebBasePage
+{
+ private boolean isStatic = false;
+ private String label = "Dynamic Separation of Duties Administration";;
+
+ public SdDynamicPage( PageParameters parameters )
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer(GlobalIds.LAYOUT);
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel( GlobalIds.SDLISTPANEL )
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new SDListPanel(id, isStatic);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ SDDetailPanel sdDetail = new SDDetailPanel( GlobalIds.SDDETAILPANEL, display, isStatic);
+ container.add(sdDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..e6d9233
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SdStaticPage.java
@@ -0,0 +1,76 @@
+/*
+ * 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.extensions.ajax.markup.html.AjaxLazyLoadPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.web.panel.Displayable;
+import org.apache.directory.fortress.web.panel.InfoPanel;
+import org.apache.directory.fortress.web.panel.NavPanel;
+import org.apache.directory.fortress.web.panel.SDDetailPanel;
+import org.apache.directory.fortress.web.panel.SDListPanel;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class SdStaticPage extends FortressWebBasePage
+{
+ private boolean isStatic = true;
+ private String label = "Static Separation of Duties Administration";
+ public SdStaticPage( PageParameters parameters )
+ {
+ add(new Label(GlobalIds.PAGE_HEADER, label));
+ WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
+ FourWaySplitter splitter = new FourWaySplitter();
+ splitter.addBorderLayout(container);
+
+ // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4. Detail
+ // Nav and Info are generic and work across all entities, the others are specific to this entity type.
+
+ // 1. Nav Panel:
+ NavPanel navPanel = new NavPanel(GlobalIds.NAVPANEL);
+
+ // 2. List Panel:
+ container.add(new AjaxLazyLoadPanel(GlobalIds.SDLISTPANEL)
+ {
+ @Override
+ public Component getLazyLoadComponent(String id)
+ {
+ return new SDListPanel(id, isStatic);
+ }
+ });
+
+ // 3. Info Panel:
+ InfoPanel infoPanel = new InfoPanel(GlobalIds.INFOPANEL);
+ container.add(infoPanel);
+
+ // 4. Detail Panel:
+ Displayable display = infoPanel.getDisplay();
+ SDDetailPanel sdDetail = new SDDetailPanel(GlobalIds.SDDETAILPANEL, display, isStatic);
+ container.add(sdDetail);
+
+ container.add(navPanel);
+ this.add(container);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..2aff832
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SecureBookmarkablePageLink.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @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 GlobalUtils.isAuthorized( roleName, servletReq );
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..ff27a61
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxButton.java
@@ -0,0 +1,50 @@
+/*
+ * 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.directory.fortress.core.rbac.Permission;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+@Authorizable
+public class SecureIndicatingAjaxButton extends IndicatingAjaxButton
+{
+ public SecureIndicatingAjaxButton( String id, String objName, String opName )
+ {
+ super( id );
+ if(!GlobalUtils.isFound( new Permission(objName, opName), this ))
+ setVisible( false );
+ }
+
+ public SecureIndicatingAjaxButton( String id, String roleName )
+ {
+ super( id );
+ HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
+ if( ! GlobalUtils.isAuthorized( roleName, servletReq ) )
+ setVisible( false );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/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
new file mode 100644
index 0000000..fd75ef6
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/SecureIndicatingAjaxLink.java
@@ -0,0 +1,46 @@
+/*
+ * 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 Shawn McKinney
+ * @version $Rev$
+ */
+public class SecureIndicatingAjaxLink extends IndicatingAjaxLink
+{
+ public SecureIndicatingAjaxLink( String id, String objName, String opName )
+ {
+ super( id );
+ if(!GlobalUtils.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/547b9ccd/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
new file mode 100644
index 0000000..de6cf11
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/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;
+
+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 Shawn McKinney
+ * @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/547b9ccd/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
new file mode 100644
index 0000000..c725f47
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
@@ -0,0 +1,174 @@
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Shawn McKinney
+ * @version $Rev$
+ * @param <T>
+ */
+public class UserListModel<T extends Serializable> extends Model
+{
+ @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 List<User> users = null;
+
+ /**
+ * Default constructor
+ */
+ public UserListModel( final Session session )
+ {
+ init( session );
+ }
+
+ /**
+ * User contains the search arguments.
+ *
+ * @param user
+ */
+ public UserListModel(User user, final Session session )
+ {
+ this.user = user;
+ init( session );
+ log.debug( "constructor userId: " + user != null ? user.getUserId() : "null" );
+ }
+
+ public UserListModel(Permission perm, final Session session )
+ {
+ this.perm = perm;
+ init( session );
+ log.debug( "constructor perm: " + perm != null ? perm.getObjName() : "null" );
+ }
+
+ private void init(final Session session )
+ {
+ Injector.get().inject( this );
+ 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 T getObject()
+ {
+ if (users != null)
+ {
+ log.debug(".getObject count: " + user != null ? users.size() : "null");
+ return (T) users;
+ }
+ if (user == null && perm == null)
+ {
+ log.debug(".getObject null");
+ users = new ArrayList<User>();
+ }
+ else
+ {
+ //log.debug(".getObject userId: " + user != null ? user.getUserId() : "null");
+ users = getList(user);
+ }
+ return (T) users;
+ }
+
+ @Override
+ public void setObject(Object object)
+ {
+ log.debug(".setObject count: " + object != null ? ((List<User>)object).size() : "null");
+ this.users = (List<User>) object;
+ }
+
+ @Override
+ public void detach()
+ {
+ //log.debug(".detach");
+ this.users = null;
+ this.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<User>();
+ 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);
+ }
+ }
+ catch (org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = ".getList caught SecurityException=" + se;
+ log.warn(error);
+ }
+ return usersList;
+ }
+}