1 19 20 package com.sslexplorer.security.forms; 21 22 import java.util.Arrays ; 23 24 import javax.servlet.http.HttpSession ; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import com.sslexplorer.core.UserDatabaseManager; 30 import com.sslexplorer.security.LogonControllerFactory; 31 import com.sslexplorer.security.Role; 32 import com.sslexplorer.security.RoleItem; 33 import com.sslexplorer.security.RoleItemModel; 34 import com.sslexplorer.table.forms.AbstractPagerForm; 35 36 37 45 public class ShowAvailableRolesForm extends AbstractPagerForm { 46 47 static Log log = LogFactory.getLog(ShowAvailableRolesForm.class); 48 49 52 public ShowAvailableRolesForm() { 53 super(new RoleItemModel()); 54 } 55 56 63 public void initialize(Role[] r, HttpSession session) throws Exception { 64 super.initialize(session, "role"); 65 for (int i = 0; r != null && i < r.length; i++) { 66 getModel().addItem( 67 new RoleItem(r[i], Arrays.asList(UserDatabaseManager.getInstance().getUserDatabase( 68 LogonControllerFactory.getInstance().getSessionInfo(session).getUser().getRealm() 69 .getResourceId()).getUsersInRole(r[i])))); 70 } 71 getPager().rebuild(getFilterText()); 72 } 73 74 } | Popular Tags |