Package com.adito.security.forms

Examples of com.adito.security.forms.ShowAvailableRolesForm


     * @throws Exception on any error
     */
    public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {     
      CoreUtil.clearFlow(request);
      ShowAvailableRolesForm showAvailableRolesForm = ((ShowAvailableRolesForm) form);
       
        try {
          UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(getSessionInfo(request).getUser().getRealm());
            Role[] roles = null;
            try {
                String filterText = showAvailableRolesForm.getFilterText();
                int maxRoleResults = userDatabase.getMaxRoleResults();
                String filter = Util.isNullOrTrimmedBlank(filterText) ? UserDatabase.WILDCARD_SEARCH : filterText;
                roles = userDatabase.listAllRoles(filter, maxRoleResults);
                if (roles.length > maxRoleResults) {
                    int newLength = roles.length - 1;
                    Role[] copy = new Role[newLength];
                    System.arraycopy(roles, 0, copy, 0, newLength);
                    roles = copy;
                    saveMessage(request, "availableRoles.match.limited", maxRoleResults);
                }
            } catch (Exception e) {
                log.error("Failed to get available roles.", e);
                ActionMessages errs = new ActionMessages();
                errs.add(Globals.ERROR_KEY, new ActionMessage("availableRoles.cannotListRoles", Util.getExceptionMessageChain(e)));
                saveErrors(request, errs);
                roles = new Role[0];
            }
            showAvailableRolesForm.initialize(roles, request.getSession());
            ActionMessages msgs = new ActionMessages();
            if (!userDatabase.supportsAccountCreation()) {
                msgs.add(Globals.MESSAGE_KEY, new ActionMessage("availableRoles.noRoleCreation.text"));
            }
            if (msgs.size() > 0) {
View Full Code Here


     * @return ActionForward
     * @throws Exception
     */
    public ActionForward redisplay(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ShowAvailableRolesForm showAvailableRolesForm = (ShowAvailableRolesForm) form;
        showAvailableRolesForm.reInitialize(request.getSession());
        return mapping.findForward("success");
    }
View Full Code Here

TOP

Related Classes of com.adito.security.forms.ShowAvailableRolesForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.