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:44 UTC
[3/5] directory-fortress-commander git commit: FC-105 - remove cycles
and fix other findbugs issues
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/UserListModel.java b/src/main/java/org/apache/directory/fortress/web/UserListModel.java
deleted file mode 100644
index 6fff40e..0000000
--- a/src/main/java/org/apache/directory/fortress/web/UserListModel.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.fortress.web;
-
-import org.apache.log4j.Logger;
-import org.apache.wicket.injection.Injector;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.directory.fortress.web.panel.UserListPanel;
-import org.apache.directory.fortress.core.DelReviewMgr;
-import org.apache.directory.fortress.core.ReviewMgr;
-import org.apache.directory.fortress.core.rbac.AdminRole;
-import org.apache.directory.fortress.core.rbac.OrgUnit;
-import org.apache.directory.fortress.core.rbac.Permission;
-import org.apache.directory.fortress.core.rbac.Role;
-import org.apache.directory.fortress.core.rbac.Session;
-import org.apache.directory.fortress.core.rbac.User;
-import org.apache.directory.fortress.core.util.attr.VUtil;
-import org.apache.directory.fortress.core.SecurityException;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class UserListModel extends Model<SerializableList<User>>
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- @SpringBean
- private ReviewMgr reviewMgr;
- @SpringBean
- private DelReviewMgr delReviewMgr;
- private static final Logger log = Logger.getLogger(UserListModel.class.getName());
- private transient User user;
- private transient Permission perm;
- private transient SerializableList<User> users = null;
-
- /**
- * Default constructor
- */
- public UserListModel( Session session )
- {
- init( session );
- }
-
-
- /**
- * User contains the search arguments.
- *
- * @param user
- */
- public UserListModel( User user, Session session )
- {
- this.user = user;
- init( session );
- log.debug( "constructor userId: " + user.getUserId() );
- }
-
-
- public UserListModel( Permission perm, Session session )
- {
- this.perm = perm;
- init( session );
- log.debug( "constructor perm: " + perm.getObjName() );
- }
-
-
- private void init( Session session )
- {
- Injector.get().inject( this );
- reviewMgr.setAdmin( session );
- }
-
-
- /**
- * This data is bound for {@link UserListPanel}
- *
- * @return T extends List<User> users data will be bound to panel data view component.
- */
- @Override
- public SerializableList<User> getObject()
- {
- if (users != null)
- {
- log.debug( ".getObject count: " + users.size() );
- return users;
- }
-
- if ( ( user == null ) && ( perm == null ))
- {
- log.debug( ".getObject null" );
- users = new SerializableList<>( new ArrayList<User>() );
- }
- else
- {
- //log.debug(".getObject userId: " + user != null ? user.getUserId() : "null");
- users = new SerializableList<>( getList( user ) );
- }
-
- return users;
- }
-
-
- @Override
- public void setObject( SerializableList<User> object )
- {
- log.debug(".setObject count: " + object.size() );
- users = object;
- }
-
-
- @Override
- public void detach()
- {
- //log.debug(".detach");
- users = null;
- user = null;
- }
-
-
- public List<User> getList(User user)
- {
- List<User> usersList = null;
-
- try
- {
- if ( perm != null )
- {
- Set<String> users = reviewMgr.authorizedPermissionUsers( perm );
-
- if ( VUtil.isNotNullOrEmpty( users ) )
- {
- usersList = new ArrayList<>();
-
- for(String userId : users)
- {
- User user1 = reviewMgr.readUser( new User( userId ) );
- usersList.add( user1 );
- }
- }
- }
- else if( VUtil.isNotNullOrEmpty( user.getOu() ) )
- {
- usersList = reviewMgr.findUsers( new OrgUnit( user.getOu(), OrgUnit.Type.USER ) );
- }
- else if ( VUtil.isNotNullOrEmpty( user.getRoles() ) )
- {
- usersList = reviewMgr.assignedUsers( new Role( user.getRoles().get( 0 ).getName() ) );
- }
- else if ( VUtil.isNotNullOrEmpty( user.getAdminRoles() ) )
- {
- usersList = delReviewMgr.assignedUsers( new AdminRole( user.getAdminRoles().get( 0 ).getName() ) );
- }
- else
- {
- usersList = reviewMgr.findUsers( user );
- }
- // sort list by userId:
- if( VUtil.isNotNullOrEmpty( usersList ))
- {
- Collections.sort( usersList, new Comparator<User>()
- {
- @Override
- public int compare(User u1, User u2)
- {
- return u1.getUserId().compareToIgnoreCase( u2.getUserId() );
- }
- } );
- }
- }
- catch ( SecurityException se )
- {
- String error = ".getList caught SecurityException=" + se;
- log.warn( error );
- }
-
- return usersList;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/UserPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/UserPage.java b/src/main/java/org/apache/directory/fortress/web/UserPage.java
index b8ac179..1fc1f99 100644
--- a/src/main/java/org/apache/directory/fortress/web/UserPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/UserPage.java
@@ -20,6 +20,7 @@
package org.apache.directory.fortress.web;
+import org.apache.directory.fortress.web.common.GlobalIds;
import org.apache.wicket.Component;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.markup.html.WebMarkupContainer;
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/WicketSession.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/WicketSession.java b/src/main/java/org/apache/directory/fortress/web/WicketSession.java
deleted file mode 100644
index 9e8bb7a..0000000
--- a/src/main/java/org/apache/directory/fortress/web/WicketSession.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.fortress.web;
-
-
-import org.apache.wicket.protocol.http.WebSession;
-import org.apache.wicket.request.Request;
-import org.apache.directory.fortress.core.rbac.Permission;
-import org.apache.directory.fortress.core.rbac.Session;
-
-import java.util.List;
-
-
-/**
- * This object is managed by wicket framework. It is used to cache a copy of a user's session and permissions.
- *
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class WicketSession extends WebSession
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
- private Session session;
- private List<Permission> permissions;
-
-
- /**
- * Constructor. Note that {@link org.apache.wicket.request.cycle.RequestCycle} is not available until this
- * constructor returns.
- *
- * @param request The current request
- */
- public WicketSession(Request request)
- {
- super( request );
- }
-
-
- public Session getSession()
- {
- return session;
- }
-
-
- public void setSession(Session session)
- {
- this.session = session;
- }
-
-
- public List<Permission> getPermissions()
- {
- return permissions;
- }
-
-
- public void setPermissions( List<Permission> permissions )
- {
- this.permissions = permissions;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
new file mode 100644
index 0000000..5be0c5b
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.common;
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class GlobalIds
+{
+ public static final String ROLE_USERS = "ROLE_USERS";
+ public static final String ROLE_ROLES = "ROLE_ROLES";
+ public static final String ROLE_PERMOBJS = "ROLE_PERMOBJS";
+ public static final String ROLE_PERMS = "ROLE_PERMS";
+ public static final String ROLE_SSDS = "ROLE_SSDS";
+ public static final String ROLE_DSDS = "ROLE_DSDS";
+ public static final String ROLE_USEROUS = "ROLE_USEROUS";
+ public static final String ROLE_PERMOUS = "ROLE_PERMOUS";
+ public static final String ROLE_POLICIES = "ROLE_POLICIES";
+ public static final String ROLE_ADMINROLES = "ROLE_ADMINROLES";
+ public static final String ROLE_ADMINOBJS = "ROLE_ADMINOBJS";
+ public static final String ROLE_ADMINPERMS = "ROLE_ADMINPERMS";
+ public static final String ROLE_AUDIT_AUTHZS = "ROLE_AUDIT_AUTHZS";
+ public static final String ROLE_AUDIT_BINDS = "ROLE_AUDIT_BINDS";
+ public static final String ROLE_AUDIT_MODS = "ROLE_AUDIT_MODS";
+ public static final String ROLE_GROUPS = "ROLE_GROUPS";
+ public static final String SSD = "SSD";
+ public static final String DSD = "DSD";
+ public static final String PAGE_TYPE = "type";
+ public static final String ADMIN_MGR = "org.apache.directory.fortress.core.rbac.AdminMgrImpl";
+ public static final String REVIEW_MGR = "org.apache.directory.fortress.core.rbac.ReviewMgrImpl";
+ public static final String DEL_ADMIN_MGR = "org.apache.directory.fortress.core.rbac.DelAdminMgrImpl";
+ public static final String DEL_REVIEW_MGR = "org.apache.directory.fortress.core.rbac.DelReviewMgrImpl";
+ public static final String PWPOLICY_MGR = "org.apache.directory.fortress.core.rbac.PwPolicyMgrImpl";
+ public static final String AUDIT_MGR = "org.apache.directory.fortress.core.rbac.AuditMgrImpl";
+ public static final String GROUP_MGR = "org.apache.directory.fortress.core.ldap.group.GroupMgrImpl";
+ public static final String ASSIGN_USER = "assignUser";
+ public static final String ADD = "add";
+ public static final String COMMIT = "commit";
+ public static final String DELETE = "delete";
+ public static final String CANCEL = "cancel";
+ public static final String TIMEOUT_ARC = "timeoutARC";
+ public static final String BEGIN_TIME_ARC = "beginTimeARC";
+ public static final String END_TIME_ARC = "endTimeARC";
+ public static final String BEGIN_DATE_ARC = "beginDateARC";
+ public static final String END_DATE_ARC = "endDateARC";
+ public static final String BEGIN_LOCK_DATE_ARC = "beginLockDateARC";
+ public static final String END_LOCK_DATE_ARC = "endLockDateARC";
+ public static final String BEGIN_TIME_RC = "beginTimeRC";
+ public static final String END_TIME_RC = "endTimeRC";
+ public static final String BEGIN_DATE_RC = "beginDateRC";
+ public static final String END_DATE_RC = "endDateRC";
+ public static final String BEGIN_LOCK_DATE_RC = "beginLockDateRC";
+ public static final String END_LOCK_DATE_RC = "endLockDateRC";
+ public static final String TIMEOUT_RC = "timeoutRC";
+ public static final String SUNDAY_RC = "sundayRC";
+ public static final String MONDAY_RC = "mondayRC";
+ public static final String TUESDAY_RC = "tuesdayRC";
+ public static final String WEDNESDAY_RC = "wednesdayRC";
+ public static final String THURSDAY_RC = "thursdayRC";
+ public static final String FRIDAY_RC = "fridayRC";
+ public static final String SATURDAY_RC = "saturdayRC";
+ public static final String ASSIGN = "assign";
+ public static final String ROLE_ASSIGNMENTS_LABEL = "roleAssignmentsLabel";
+ public static final String SELECT = "select";
+ public static final String SEARCH = "search";
+ public static final String CLEAR = "clear";
+ public static final String SEARCH_VAL = "searchVal";
+ public static final String MONDAY_ARC = "mondayARC";
+ public static final String TUESDAY_ARC = "tuesdayARC";
+ public static final String WEDNESDAY_ARC = "wednesdayARC";
+ public static final String THURSDAY_ARC = "thursdayARC";
+ public static final String FRIDAY_ARC = "fridayARC";
+ public static final String ASSIGN_ADMIN_ROLE = "assignAdminRole";
+ public static final String DESCRIPTION = "description";
+ public static final String EMAILS = "emails";
+ public static final String PHONES = "phones";
+ public static final String MOBILES = "mobiles";
+ public static final String ADDRESS_ASSIGNMENTS_LABEL = "addressAssignmentsLabel";
+ public static final String ADDRESSES = "addresses";
+ public static final String ADDRESS_CITY = "address.city";
+ public static final String ADDRESS_STATE = "address.state";
+ public static final String ADDRESS_COUNTRY = "address.country";
+ public static final String ADDRESS_POSTAL_CODE = "address.postalCode";
+ public static final String ADDRESS_POST_OFFICE_BOX = "address.postOfficeBox";
+ public static final String ADDRESS_BUILDING = "address.building";
+ public static final String ADDRESS_DEPARTMENT_NUMBER = "address.departmentNumber";
+ public static final String ADDRESS_ROOM_NUMBER = "address.roomNumber";
+ public static final String TEMPORAL_CONSTRAINTS_LABEL = "temporalConstraintsLabel";
+ public static final String BEGIN_TIME_P = "beginTimeP";
+ public static final String END_TIME_P = "endTimeP";
+ public static final String BEGIN_DATE_P = "beginDateP";
+ public static final String END_DATE_P = "endDateP";
+ public static final String BEGIN_LOCK_DATE_P = "beginLockDateP";
+ public static final String END_LOCK_DATE_P = "endLockDateP";
+ public static final String TIMEOUT_P = "timeoutP";
+ public static final String SUNDAY_P = "sundayP";
+ public static final String MONDAY_P = "mondayP";
+ public static final String TUESDAY_P = "tuesdayP";
+ public static final String WEDNESDAY_P = "wednesdayP";
+ public static final String THURSDAY_P = "thursdayP";
+ public static final String FRIDAY_P = "fridayP";
+ public static final String SATURDAY_P = "saturdayP";
+ public static final String SYSTEM_INFO_LABEL = "systemInfoLabel";
+ public static final String SYSTEM = "system";
+ public static final String CN = "cn";
+ public static final String SN = "sn";
+ public static final String IMPORT_PHOTO_LABEL = "importPhotoLabel";
+ public static final String SAVE = "save";
+ public static final String NAME = "name";
+ public static final String USER_ID = "userId";
+ public static final String PSWD_FIELD = "pswdField";
+ public static final String LOGIN = "login";
+ public static final String EMPLOYEE_TYPE = "employeeType";
+ public static final String TITLE = "title";
+ public static final String GROUP_PAGE = "groups";
+ public static final String AUDIT_AUTHZS_PAGE = "authzs";
+ public static final String AUDIT_MODS_PAGE = "mods";
+ public static final String AUDIT_BINDS_PAGE = "binds";
+ public static final String JPEGPHOTO = "jpegPhoto";
+ public static final String OU = "ou";
+ public static final String REQ_AUTHZ_ID = "reqAuthzID";
+ public static final String REQ_DN = "reqDN";
+ public static final String REQ_RESULT = "reqResult";
+ public static final String REQ_START = "reqStart";
+ public static final String REQ_ATTR = "reqAttr";
+ public static final String REQ_ATTRS_ONLY = "reqAttrsOnly";
+ public static final String REQ_DEREF_ALIASES = "reqDerefAliases";
+ public static final String AUTHZ_SUCCESS_CODE = "6";
+ public static final String BIND_SUCCESS_CODE = "0";
+ public static final String SUCCESS = "SUCCESS";
+ public static final String FAILURE = "FAILURE";
+ public static final String AUDIT_TIMESTAMP_FORMAT = "MM/dd/yyyy HH:mm:ss";
+ public static final String FIND_USERS = "findUsers";
+ public static final String FIND_PERMISSIONS = "findPermissions";
+ public static final String ONBLUR = "onblur";
+ public static final String ADDRESS_ADDRESSES = "address.addresses";
+ public static final String FT_MOD_ID = "ftModId";
+ public static final String FT_MODIFIER = "ftModifier";
+ public static final String FT_MOD_CODE = "ftModCode";
+
+ public static final String OBJ_NAME = "objName";
+ public static final String OP_NAME = "opName";
+ public static final String FAILED_ONLY = "failedOnly";
+ public static final String ADMIN = "admin";
+ public static final String GET_USER_AUTHZS = "getUserAuthZs";
+ public static final String GET_USER_BINDS = "searchBinds";
+ public static final String OBJECT_ID = "objId";
+ public static final String USERS_PAGE = "users";
+ public static final String ROLES_PAGE = "roles";
+ public static final String ADMROLES_PAGE = "admroles";
+ public static final String POBJS_PAGE = "pobjs";
+ public static final String ADMPERMS_PAGE = "admperms";
+ public static final String PERMS_PAGE = "perms";
+ public static final String PWPOLICIES_PAGE = "pwpolicies";
+ public static final String SSDS_PAGE = "ssds";
+ public static final String DSDS_PAGE = "dsds";
+ public static final String USEROUS_PAGE = "userous";
+ public static final String PERMOUS_PAGE = "permous";
+ public static final String ADMPOBJS_PAGE = "admpobjs";
+ public static final String WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML = "window.location.replace(\"/fortress-web/home.html\");";
+
+ public static final String WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE = "Wicket.Window.unloadConfirmation = false;";
+ public static final String ADD_USER = "addUser";
+ public static final String UPDATE_USER = "updateUser";
+ public static final String DELETE_USER = "deleteUser";
+ public static final String DEASSIGN = "deassign";
+ public static final String DEASSIGN_USER = "deassignUser";
+ public static final String NAVPANEL = "navpanel";
+ public static final String INFOPANEL = "infopanel";
+ public static final String OBJECTLISTPANEL = "objectlistpanel";
+ public static final String OBJECTDETAILPANEL = "objectdetailpanel";
+ public static final String OULISTPANEL = "oulistpanel";
+ public static final String OUDETAILPANEL = "oudetailpanel";
+ public static final String PERMLISTPANEL = "permlistpanel";
+ public static final String PERMDETAILPANEL = "permdetailpanel";
+ public static final String ROLELISTPANEL = "rolelistpanel";
+ public static final String ROLEDETAILPANEL = "roledetailpanel";
+ public static final String SDLISTPANEL = "sdlistpanel";
+ public static final String SDDETAILPANEL = "sddetailpanel";
+ public static final String GROUPLISTPANEL = "grouplistpanel";
+ public static final String GROUPDETAILPANEL = "groupdetailpanel";
+ public static final String LAYOUT = "layout";
+ public static final String PAGE_HEADER = "pageHeader";
+ public static final String DETAIL_FIELDS = "detailFields";
+ public static final String EDIT_FIELDS = "editFields";
+ public static final String USERAUDITDETAILPANEL = "userauditdetailpanel";
+ public static final String BEGIN_DATE = "beginDate";
+ public static final String END_DATE = "endDate";
+
+ public static final String FIND_ROLES = "findRoles";
+ public static final String ROLEAUXPANEL = "roleauxpanel";
+ public static final String ADD_ROLE = "addRole";
+ public static final String UPDATE_ROLE = "updateRole";
+ public static final String DELETE_ROLE = "deleteRole";
+ public static final String PARENTS = "parents";
+ public static final String OS_P = "osP";
+ public static final String OS_U = "osU";
+ public static final String BEGIN_RANGE = "beginRange";
+ public static final String BEGIN_INCLUSIVE = "beginInclusive";
+ public static final String END_RANGE = "endRange";
+ public static final String END_INCLUSIVE = "endInclusive";
+ public static final String PERMOU_SEARCH = "permou.search";
+ public static final String USEROU_SEARCH = "userou.search";
+ public static final String BEGIN_RANGE_SEARCH = "beginRange.search";
+ public static final String END_RANGE_SEARCH = "endRange.search";
+ public static final String PARENTROLES_SEARCH = "parentroles.search";
+ public static final String POLICY_SEARCH = "policy.search";
+ public static final String OU_SEARCH = "ou.search";
+ public static final String ROLES_SEARCH = "roles.search";
+ public static final String FIELD_2 = "field2";
+ public static final String FIELD_1 = "field1";
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
new file mode 100644
index 0000000..70991f4
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/FtBookmarkablePageLink.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+
+
+/**
+ * This link requires the id format be: objname.operationname
+ * where name maps to ft perm obj name and op maps to ft perm op name.
+ * If match not found link will quietly not display the link on page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class FtBookmarkablePageLink extends BookmarkablePageLink
+{
+ private static final Logger LOG = Logger.getLogger( FtBookmarkablePageLink.class.getName() );
+ Permission perm;
+
+ public <C extends Page> FtBookmarkablePageLink( String id, Class<C> pageClass )
+ {
+ super( id, pageClass );
+ perm = SecUtils.getPermFromId( id );
+ if ( perm != null && SecUtils.isFound( perm, this ) )
+ {
+ LOG.debug( "FtBookmarkablePageLink id: " + id + ", status found" );
+ }
+ else
+ {
+ LOG.debug( "FtBookmarkablePageLink id: " + id + ", status NOT found" );
+ setVisible( false );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
new file mode 100644
index 0000000..35e61cd
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/FtIndicatingAjaxButton.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
+import org.apache.log4j.Logger;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class FtIndicatingAjaxButton extends IndicatingAjaxButton
+{
+ Permission perm;
+
+ @SpringBean
+ private AccessMgr accessMgr;
+
+ private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
+
+ public FtIndicatingAjaxButton(String id)
+ {
+ super( id );
+ String[] parts = id.split( "\\." );
+ if(parts != null && parts.length > 1)
+ {
+ String objName = parts[0];
+ String opName = parts[1];
+ this.perm = new Permission(objName, opName);
+ if ( SecUtils.isFound( perm, this ) )
+ {
+ LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status found" );
+ }
+ else
+ {
+ LOG.debug( "FtIndicatingAjaxButton id: " + id + ", status NOT found" );
+ setVisible( false );
+ }
+
+ }
+ else
+ {
+ throw new RuntimeException( "FtIndicatingAjaxButton Constructor ID: " + id + ", requires objectname.opname format" );
+ }
+ }
+
+ protected boolean checkAccess( )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+
+ protected boolean checkAccess( String objectId )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
+ isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
new file mode 100644
index 0000000..2988571
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecUtils.java
@@ -0,0 +1,403 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.cfg.Config;
+import org.apache.directory.fortress.core.rbac.UserRole;
+import org.apache.directory.fortress.core.rbac.Warning;
+import org.apache.directory.fortress.realm.*;
+import org.apache.directory.fortress.realm.GlobalIds;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Component;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Session;
+import org.apache.directory.fortress.core.rbac.User;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+import java.util.List;
+
+/**
+ * Common static utils and wrappers used by Wicket web apps to make fortress style security calls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecUtils
+{
+ private static final Logger LOG = Logger.getLogger( SecUtils.class.getName() );
+ private static final String PERMS_CACHED = "perms.cached";
+ public static final boolean IS_PERM_CACHED = ( ( Config.getProperty( PERMS_CACHED ) != null ) && ( Config
+ .getProperty( PERMS_CACHED ).equalsIgnoreCase( "true" ) ) );
+
+ /**
+ * Return the fortress session that is cached within the wicket session object.
+ *
+ * @param component needed to get handle to wicket session.
+ * @return fortress session object.
+ */
+ public static Session getSession(Component component)
+ {
+ return ( ( WicketSession ) component.getSession() ).getSession();
+ }
+
+ /**
+ * Used when web app needs to create a 'trusted' fortress session.
+ *
+ * Does not check user's password.
+ *
+ * @param accessMgr fortress access mgr apis
+ * @param userId required for rbac session creation.
+ * @return rbac session.
+ */
+ public static Session createSession(AccessMgr accessMgr, String userId)
+ {
+ Session session;
+ try
+ {
+ // Create an RBAC session and attach to Wicket session:
+ session = accessMgr.createSession( new User( userId ), true );
+ String message = "RBAC Session successfully created for userId: " + session.getUserId();
+ LOG.debug( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "createSession caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ return session;
+ }
+
+ /**
+ * Here the wicket session is loaded with the fortress session and permissions.
+ *
+ *
+ * @param delAccessMgr needed to pull back fortress arbac permissions.
+ * @param session needed for call into accessMgr.
+ */
+ public static void loadPermissionsIntoSession( DelAccessMgr delAccessMgr, Session session)
+ {
+ try
+ {
+ // Retrieve user permissions and attach fortress session to Wicket session:
+ ( ( WicketSession ) WicketSession.get() ).setSession( session );
+ List<Permission> permissions = delAccessMgr.sessionPermissions( session );
+ ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
+ String message = "Session successfully created for userId: " + session.getUserId();
+ LOG.debug( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "loadPermissionsIntoSession caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ }
+
+ /**
+ * Returns the fortress arbac perms that are cashed in the wicket session.
+ *
+ * @param component needed to get a handle on the wicket session object.
+ * @return collection of fortress admin perms.
+ */
+ public static List<Permission> getPermissions(Component component)
+ {
+ return ( ( WicketSession ) component.getSession() ).getPermissions();
+ }
+
+ /**
+ * Retrieve RBAC session permissions from Fortress and place in the Wicket session.
+ */
+ public static void getPermissions( Component component, AccessMgr accessMgr )
+ {
+ try
+ {
+ if ( IS_PERM_CACHED )
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ List<Permission> permissions = accessMgr.sessionPermissions( session.getSession() );
+ ( ( WicketSession ) WicketSession.get() ).setPermissions( permissions );
+ }
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String error = "getPermissions caught SecurityException=" + se;
+ LOG.error( error );
+ throw new RuntimeException( error );
+ }
+ }
+
+ /**
+ * Wrapper for the httpservlet isUserInRole api.
+ *
+ * @param roleName contains the name of role being checked.
+ * @param servletReq handle used to make inquiry.
+ * @return true if authorized, false otherwise.
+ */
+ public static boolean isAuthorized( String roleName, HttpServletRequest servletReq )
+ {
+ boolean isAuthorized = false;
+ if ( servletReq.isUserInRole( roleName ) )
+ {
+ isAuthorized = true;
+ }
+ return isAuthorized;
+ }
+
+ /**
+ * Is the supplied permission in the wicket session cache? Called by buttons.
+ * if not found, button will be invisible.
+ *
+ * @param permission fortress perm requires {link @Permission#objName} and {link @Permission#opName} are set.
+ * @param component needed to get handle on the wicket session object.
+ * @return true if found, false otherwise
+ */
+ public static boolean isFound( Permission permission, Component component )
+ {
+ List<Permission> permissions = SecUtils.getPermissions( component );
+ return VUtil.isNotNullOrEmpty( permissions ) && permissions.contains( permission );
+ }
+
+ /**
+ * Wrapper to fortress checkAccess api.
+ *
+ * @param component contains the wicket session handle.
+ * @param accessMgr has the checkAccess api
+ * @param objName string value
+ * @param opName string value
+ * @param objId string value
+ * @return true if success, false otherwise.
+ * @throws org.apache.directory.fortress.core.SecurityException checked exception for system errors.
+ */
+ public static boolean checkAccess(Component component, AccessMgr accessMgr, String objName, String opName, String objId ) throws org.apache.directory.fortress.core.SecurityException
+ {
+ WicketSession session = ( WicketSession )component.getSession();
+ Permission permission = new Permission( objName, opName, objId );
+ return accessMgr.checkAccess( session.getSession(), permission );
+ }
+
+ /**
+ * Convert the principal into fortress session and load into wicket session along with perms.
+ *
+ * @param component contains handle to wicket session.
+ * @param j2eePolicyMgr used to call deserize api
+ * @param accessMgr used to call fortress api for role op
+ * @param szPrincipal contains the instance of fortress session deserialized.
+ */
+ public static void initializeSession(Component component, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr, String szPrincipal ) throws SecurityException
+ {
+ Session realmSession = null;
+
+ if(j2eePolicyMgr == null || accessMgr == null)
+ {
+ throw new SecurityException( GlobalIds.SESSION_INITIALIZATION_FAILED, "initializeSession failed - verify the injection of fortress spring beans into your application" );
+ }
+ try
+ {
+ if(VUtil.isNotNullOrEmpty( szPrincipal ))
+ realmSession = j2eePolicyMgr.deserialize( szPrincipal );
+ }
+ catch( SecurityException se )
+ {
+ throw new RuntimeException( se );
+ }
+ if(realmSession != null)
+ {
+ synchronized ( ( WicketSession ) WicketSession.get() )
+ {
+ if ( SecUtils.getSession( component ) == null )
+ {
+ LOG.info( "realmSession user: " + realmSession.getUserId() );
+ // Retrieve user permissions and attach RBAC session to Wicket session:
+ ( ( WicketSession ) WicketSession.get() ).setSession( realmSession );
+ getPermissions( component, accessMgr );
+ }
+ }
+ }
+ }
+
+ /**
+ * Call RBAC addActiveRole to activate a new role into user's session.
+ * This routine must first retrieves the wicket session.
+ * It is needed because it contains the fortress session which is required for api.
+ * Next it invokes the fortress addActiveRole method.
+ * If all successful refresh user's perms cached as they've changed.
+ *
+ * @param component contains handle to wicket session.
+ * @param target used to display modal if something goes wrong
+ * @param accessMgr used to call fortress api for role op
+ * @param roleName contains the role name target
+ * @return true if success, false otherwise.
+ */
+ public static boolean addActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
+ {
+ boolean isSuccessful = false;
+ try
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ session.getSession().setWarnings( null );
+ accessMgr.addActiveRole( session.getSession(), new UserRole( roleName ) );
+ List<Warning> warnings = session.getSession().getWarnings();
+ if ( VUtil.isNotNullOrEmpty( warnings ) )
+ {
+ for ( Warning warning : warnings )
+ {
+ LOG.info( "Warning: " + warning.getMsg() + " errCode: " + warning.getId() + " name: " + warning
+ .getName() + " type: " + warning.getType().toString() );
+ if ( warning.getType() == Warning.Type.ROLE && warning.getName().equalsIgnoreCase( roleName ) )
+ {
+ String error = warning.getMsg() + " code: " + warning.getId();
+ LOG.error( error );
+ target.appendJavaScript( ";alert('" + error + "');" );
+ return false;
+ }
+ }
+ }
+
+ // User's active role set changed so refresh their permissions:
+ SecUtils.getPermissions( component, accessMgr );
+ isSuccessful = true;
+ String message = "Activate role name: " + roleName + " successful";
+ LOG.info( message );
+ }
+ catch ( org.apache.directory.fortress.core.SecurityException se )
+ {
+ String msg = "Role selection " + roleName + " activation failed because of ";
+ if ( se.getErrorId() == GlobalErrIds.DSD_VALIDATION_FAILED )
+ {
+ msg += "Dynamic SoD rule violation";
+ }
+ else if ( se.getErrorId() == GlobalErrIds.URLE_ALREADY_ACTIVE )
+ {
+ msg += "Role already active in Session";
+ }
+ else
+ {
+ msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
+ }
+ LOG.error( msg );
+ target.appendJavaScript( ";alert('" + msg + "');" );
+ }
+ return isSuccessful;
+ }
+
+ /**
+ * Call RBAC dropActiveRole to deactivate a new role from user's session.
+ * This routine must first retrieves the wicket session.
+ * It is needed because it contains the fortress session which is required for api.
+ * Next it invokes the fortress dropActiveRole method.
+ * If all successful refresh user's perms cached as they've changed.
+ *
+ * @param component contains handle to wicket session.
+ * @param target used to display modal if something goes wrong
+ * @param accessMgr used to call fortress api for role op
+ * @param roleName contains the role name target
+ * @return true if success, false otherwise.
+ */
+ public static boolean dropActiveRole( Component component, AjaxRequestTarget target, AccessMgr accessMgr, String roleName )
+ {
+ boolean isSuccessful = false;
+ try
+ {
+ WicketSession session = ( WicketSession ) component.getSession();
+ accessMgr.dropActiveRole( session.getSession(), new UserRole( roleName ) );
+ // User's active role set changed so refresh their permissions:
+ SecUtils.getPermissions( component, accessMgr );
+ isSuccessful = true;
+ LOG.info( "Fortress dropActiveRole roleName: " + roleName + " was successful" );
+ }
+ catch ( SecurityException se )
+ {
+ String msg = "Role selection " + roleName + " deactivation failed because of ";
+ if ( se.getErrorId() == GlobalErrIds.URLE_NOT_ACTIVE )
+ {
+ msg += "Role not active in session";
+ }
+ else
+ {
+ msg += "System error: " + se + ", " + "errId=" + se.getErrorId();
+ }
+ LOG.error( msg );
+ target.appendJavaScript( ";alert('" + msg + "');" );
+ }
+ return isSuccessful;
+ }
+
+ /**
+ * Enables fortress session on behalf of a java.security.Principal retrieved from the container.
+ *
+ * @param component
+ * @param servletReq
+ * @param j2eePolicyMgr
+ * @param accessMgr
+ * @throws SecurityException
+ */
+ public static void enableFortress( Component component, HttpServletRequest servletReq, J2eePolicyMgr j2eePolicyMgr, AccessMgr accessMgr ) throws SecurityException
+ {
+ // Get the principal from the container:
+ Principal principal = servletReq.getUserPrincipal();
+ // Is this a Java EE secured page && has the User successfully authenticated already?
+ boolean isSecured = principal != null;
+ if(isSecured)
+ {
+ //linksLabel += " for " + principal.getName();
+ if( !isLoggedIn( component ) )
+ {
+ String szPrincipal = principal.toString();
+ // Pull the fortress session from the realm and assert into the Web app's session along with user's perms:
+ SecUtils.initializeSession( component, j2eePolicyMgr, accessMgr, szPrincipal );
+ }
+ }
+ }
+
+ /**
+ * If user has a wicket session then considered logged in.
+ *
+ * @return true if wicket session is not null
+ */
+ public static boolean isLoggedIn( Component component )
+ {
+ boolean isLoggedIn = false;
+ if ( getSession( component ) != null )
+ {
+ isLoggedIn = true;
+ }
+ return isLoggedIn;
+ }
+
+ public static Permission getPermFromId( String id )
+ {
+ Permission perm = null;
+ String[] parts = id.split( "\\." );
+ if(parts != null && parts.length > 1)
+ {
+ String objName = parts[0];
+ String opName = parts[1];
+ perm = new Permission( objName, opName );
+ }
+ return perm;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
new file mode 100644
index 0000000..9f73d6c
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureBookmarkablePageLink.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.StringTokenizer;
+
+
+/**
+ * ...
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecureBookmarkablePageLink extends BookmarkablePageLink
+{
+ public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, String roleName )
+ {
+ super( id, pageClass );
+ if(!isAuthorized( roleName ))
+ {
+ setVisible( false );
+ }
+ }
+
+ public <C extends Page> SecureBookmarkablePageLink( String id, Class<C> pageClass, PageParameters parameters,
+ String roleName )
+ {
+ super( id, pageClass, parameters );
+ if ( !isAuthorized( roleName ) )
+ {
+ setVisible( false );
+ }
+ }
+
+ private boolean isAuthorized( String roleName )
+ {
+ HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
+ return isAuthorized( roleName, servletReq );
+ }
+
+ private boolean isAuthorized( String roleNames, HttpServletRequest servletReq )
+ {
+ boolean isAuthorized = false;
+ StringTokenizer tokenizer = new StringTokenizer( roleNames, "," );
+ if (tokenizer.countTokens() > 0)
+ {
+ while (tokenizer.hasMoreTokens())
+ {
+ String roleName = tokenizer.nextToken();
+ isAuthorized = SecUtils.isAuthorized( roleName, servletReq );
+ }
+ }
+ return isAuthorized;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java
new file mode 100644
index 0000000..419cb20
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxButton.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+import com.googlecode.wicket.jquery.ui.form.button.IndicatingAjaxButton;
+import org.apache.log4j.Logger;
+import org.apache.wicket.Component;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ...
+ *
+ * @author Shawn McKinney
+ * @version $Rev$
+ */
+public class SecureIndicatingAjaxButton extends IndicatingAjaxButton
+{
+ Permission perm;
+
+ @SpringBean
+ private AccessMgr accessMgr;
+
+ private static final Logger LOG = Logger.getLogger( SecureIndicatingAjaxButton.class.getName() );
+
+ public SecureIndicatingAjaxButton( Component component, String id, String objectName, String opName )
+ {
+ super( id );
+ this.perm = new Permission(objectName, opName);
+ if( SecUtils.IS_PERM_CACHED)
+ {
+ if(!SecUtils.isFound( perm, this ))
+ setVisible( false );
+ }
+ else
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )component.getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objectName: " + objectName + " operationName: " + opName + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + objectName + " operationName: " + opName + " error=" + se;
+ LOG.error( error );
+ }
+ if(!isAuthorized)
+ setVisible( false );
+ }
+ }
+
+ public SecureIndicatingAjaxButton( String id, String roleName )
+ {
+ super( id );
+ HttpServletRequest servletReq = ( HttpServletRequest ) getRequest().getContainerRequest();
+ if( ! SecUtils.isAuthorized( roleName, servletReq ) )
+ setVisible( false );
+ }
+
+ public SecureIndicatingAjaxButton( String id, String objName, String opName )
+ {
+ super( id );
+ if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
+ setVisible( false );
+ }
+
+ protected boolean checkAccess( String objectName, String opName )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission permission = new Permission( objectName, opName );
+ //Permission permission = new Permission( objectName, perm.getOpName() );
+ isAuthorized = accessMgr.checkAccess( session.getSession(), permission );
+ LOG.info( "Fortress checkAccess objectName: " + permission.getObjName() + " operationName: " + permission.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " operationName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+ protected boolean checkAccess( )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ isAuthorized = accessMgr.checkAccess( session.getSession(), perm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + " error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+
+
+ protected boolean checkAccess( String objectId )
+ {
+ boolean isAuthorized = false;
+ try
+ {
+ WicketSession session = ( WicketSession )getSession();
+ Permission finePerm = new Permission(perm.getObjName(), perm.getOpName(), objectId);
+ isAuthorized = accessMgr.checkAccess( session.getSession(), finePerm );
+ LOG.info( "Fortress checkAccess objName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + finePerm.getObjId() + ", userId: " + session.getSession().getUserId() + " result: " + isAuthorized);
+ }
+ catch(org.apache.directory.fortress.core.SecurityException se)
+ {
+ String error = "Fortress SecurityException checkAccess objectName: " + this.perm.getObjName() + " opName: " + this.perm.getOpName() + ", objId: " + objectId + ", error=" + se;
+ LOG.error( error );
+ }
+ return isAuthorized;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
new file mode 100644
index 0000000..c978610
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/SecureIndicatingAjaxLink.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.directory.fortress.core.rbac.Permission;
+
+
+/**
+ * ...
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SecureIndicatingAjaxLink extends IndicatingAjaxLink
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+
+ public SecureIndicatingAjaxLink( String id, String objName, String opName )
+ {
+ super( id );
+ if ( !SecUtils.isFound( new Permission( objName, opName ), this ) )
+ setEnabled( false );
+ }
+
+
+ @Override
+ public void onClick( AjaxRequestTarget target )
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
new file mode 100644
index 0000000..03fe3b9
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/control/WicketSession.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.control;
+
+
+import org.apache.wicket.protocol.http.WebSession;
+import org.apache.wicket.request.Request;
+import org.apache.directory.fortress.core.rbac.Permission;
+import org.apache.directory.fortress.core.rbac.Session;
+
+import java.util.List;
+
+
+/**
+ * This object is managed by wicket framework. It is used to cache a copy of a user's session and permissions.
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class WicketSession extends WebSession
+{
+ /** Default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+ private Session session;
+ private List<Permission> permissions;
+
+
+ /**
+ * Constructor. Note that {@link org.apache.wicket.request.cycle.RequestCycle} is not available until this
+ * constructor returns.
+ *
+ * @param request The current request
+ */
+ public WicketSession(Request request)
+ {
+ super( request );
+ }
+
+
+ public Session getSession()
+ {
+ return session;
+ }
+
+
+ public void setSession(Session session)
+ {
+ this.session = session;
+ }
+
+
+ public List<Permission> getPermissions()
+ {
+ return permissions;
+ }
+
+
+ public void setPermissions( List<Permission> permissions )
+ {
+ this.permissions = permissions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
new file mode 100644
index 0000000..12e5701
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/AjaxUpdateEvent.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.event;
+
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AjaxUpdateEvent
+{
+
+ private final AjaxRequestTarget target;
+
+ public AjaxUpdateEvent(AjaxRequestTarget target)
+ {
+ this.target = target;
+ }
+
+ public AjaxRequestTarget getAjaxRequestTarget()
+ {
+ return target;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
new file mode 100644
index 0000000..1033187
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/SaveModelEvent.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.event;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.request.ILogData;
+import org.apache.wicket.request.IRequestCycle;
+import org.apache.wicket.request.component.IRequestablePage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.core.rbac.FortEntity;
+
+import java.util.Collection;
+
+/**
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SaveModelEvent extends AjaxUpdateEvent
+{
+ private int index = 0;
+ private FortEntity entity;
+
+ public Operations getOperation()
+ {
+ return operation;
+ }
+
+ public void setOperation(Operations operation)
+ {
+ this.operation = operation;
+ }
+
+ private Operations operation;
+
+ public enum Operations
+ {
+ ADD,
+ UPDATE,
+ SEARCH,
+ DELETE
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target)
+ {
+ super(target);
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, int index)
+ {
+ super(target);
+ this.index = index;
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, FortEntity entity)
+ {
+ super(target);
+ this.entity = entity;
+ }
+
+ public SaveModelEvent(AjaxRequestTarget target, FortEntity entity, Operations operation)
+ {
+ super(target);
+ this.entity = entity;
+ this.operation = operation;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public FortEntity getEntity()
+ {
+ return entity;
+ }
+
+ public void setEntity(FortEntity entity)
+ {
+ this.entity = entity;
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target, Operations operation)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity, operation));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity)
+ {
+ AjaxRequestTarget target = new AjaxRequestTarget()
+ {
+ @Override
+ public void add(Component component, String markupId)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ //component.
+ }
+ @Override
+ public void add(Component... components)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addChildren(MarkupContainer parent, Class<?> childCriteria)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addListener(IListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void appendJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void prependJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void registerRespondListener(ITargetRespondListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Collection<? extends Component> getComponents()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void focusComponent(Component component)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public IHeaderResponse getHeaderResponse()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public String getLastFocusedElementId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Page getPage()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public ILogData getLogData()
+
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getPageId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public boolean isPageInstanceCreated()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getRenderCount()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Class<? extends IRequestablePage> getPageClass()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public PageParameters getPageParameters()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void respond(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void detach(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ };
+/*
+ //AjaxRequestTarget target = AjaxRequestTarget.get();
+ if (target != null) { //...then this is an ajax request, not a static one
+ target.addComponent(myComponent);
+ }
+*/
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/fe719b1b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
new file mode 100644
index 0000000..8f02b51
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/web/event/SelectModelEvent.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.web.event;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.request.ILogData;
+import org.apache.wicket.request.IRequestCycle;
+import org.apache.wicket.request.component.IRequestablePage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.directory.fortress.core.rbac.FortEntity;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SelectModelEvent extends AjaxUpdateEvent
+{
+ private int index = 0;
+ private FortEntity entity;
+
+ public SelectModelEvent(AjaxRequestTarget target)
+ {
+ super(target);
+ }
+
+ public SelectModelEvent(AjaxRequestTarget target, int index)
+ {
+ super(target);
+ this.index = index;
+ }
+
+ public SelectModelEvent(AjaxRequestTarget target, FortEntity entity)
+ {
+ super(target);
+ this.entity = entity;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public FortEntity getEntity()
+ {
+ return entity;
+ }
+
+ public void setEntity(FortEntity entity)
+ {
+ this.entity = entity;
+ }
+
+ public static void send(Page page, Component component, FortEntity entity)
+ {
+ AjaxRequestTarget target = new AjaxRequestTarget()
+ {
+ @Override
+ public void add(Component component, String markupId)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ //component.
+ }
+ @Override
+ public void add(Component... components)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addChildren(MarkupContainer parent, Class<?> childCriteria)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void addListener(IListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void appendJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void prependJavaScript(CharSequence javascript)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void registerRespondListener(ITargetRespondListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Collection<? extends Component> getComponents()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void focusComponent(Component component)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public IHeaderResponse getHeaderResponse()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public String getLastFocusedElementId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Page getPage()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public ILogData getLogData()
+
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getPageId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public boolean isPageInstanceCreated()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Integer getRenderCount()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public Class<? extends IRequestablePage> getPageClass()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public PageParameters getPageParameters()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void respond(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ @Override
+ public void detach(IRequestCycle iRequestCycle)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ };
+ component.send(page, Broadcast.BREADTH, new SelectModelEvent(target, entity));
+ }
+
+ public static void send(Page page, Component component, FortEntity entity, AjaxRequestTarget target)
+ {
+ component.send(page, Broadcast.BREADTH, new SaveModelEvent(target, entity));
+ }
+}
\ No newline at end of file