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:46 UTC
[5/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
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;
- }
-}