Package com.ibm.portal.state.accesscheck

This package allows to attach access control checks to EngineURLs.

See:
          Description

Interface Summary
CheckedEngineURL In addition to the functionality of EngineURL the CheckedEngineURL allows setting access control checks that must be fullfilled before the URL is generated.
Constants This interface provides the access control check constants that can be applied to an CheckedEngineURL.
Constants.AccessCheck Access check interface that all constants used for access control check on the CheckedEngineURL need to implement.
 

Class Summary
Constants.AssignRolesConstant Access control permission to assign portal roles to users or groups.
Constants.CreatePageConstant Access control permission to create a new portal page.
Constants.DeletePageConstant Access control permission to deletet a portal page.
Constants.EditPageConstant Access control permission to edit a portal page.
Constants.NoCheckConstant No access control check is performed.
 

Package com.ibm.portal.state.accesscheck Description

This package allows to attach access control checks to EngineURLs.

Package Specification

The com.ibm.portal.state.accesscheck package provides access to URLs to which access control checks can be attached. These URLs will only be generated if the provided user has the appropriate access control rights.

Example

The following example attaches the EDIT_PAGE access control check to an EngineURL.

                // ----- this code needs to be executed only once ----- 
                // get an instance of the state manager service 
                StateManagerService service =  (StateManagerService) 
                ServiceManager.getService(StateManagerService.class, true); 
                // get the state manager from service for this thread 
                StateManager manager = service.getStateManager(); 
                // fetch the StateAccessorFactory 
                stateFactory = (StateAccessorFactory) manager.getAccessorFactory(StateAccessorFactory.class); 
                // fetch the CheckedURLAccessorFactory 
                urlFactory = (CheckedURLAccessorFactory) manager.getAccessorFactory(CheckedURLAccessorFactory.class); 


                // ----- this code needs to be done per request ----- 
                // (1) create a new engine url which encodes the current state 
                StateHolder state = stateFactory.getState().getStateHolder(request);
                CheckedEngineURL url = urlFactory.newURL(request, state, null);
                // (2) set an access control check
                url.setCheck(Constants.EDIT_PAGE, request.getUserPrincipal()); 
                // (3) write to the response stream directly 
                try {
                        url.writeDispose(outputStream);
                }
                catch (Exception e) {
                        // do some exception handling here
                }