use of password.pwm.util.LDAPPermissionCalculator in project pwm by pwm-project.
the class ConfigGuideUtils method forwardToJSP.
static void forwardToJSP(final PwmRequest pwmRequest) throws IOException, ServletException, PwmUnrecoverableException {
final ConfigGuideBean configGuideBean = pwmRequest.getPwmApplication().getSessionStateService().getBean(pwmRequest, ConfigGuideBean.class);
if (configGuideBean.getStep() == GuideStep.LDAP_PERMISSIONS) {
final LDAPPermissionCalculator ldapPermissionCalculator = new LDAPPermissionCalculator(ConfigGuideForm.generateStoredConfig(configGuideBean));
pwmRequest.setAttribute(PwmRequestAttribute.LdapPermissionItems, ldapPermissionCalculator);
}
final HttpServletRequest req = pwmRequest.getHttpServletRequest();
final ServletContext servletContext = req.getSession().getServletContext();
String destURL = '/' + PwmConstants.URL_JSP_CONFIG_GUIDE;
destURL = destURL.replace("%1%", configGuideBean.getStep().toString().toLowerCase());
servletContext.getRequestDispatcher(destURL).forward(req, pwmRequest.getPwmResponse().getHttpServletResponse());
}
use of password.pwm.util.LDAPPermissionCalculator in project pwm by pwm-project.
the class ConfigManagerServlet method showPermissions.
private void showPermissions(final PwmRequest pwmRequest) throws IOException, ServletException, PwmUnrecoverableException {
final StoredConfigurationImpl storedConfiguration = readCurrentConfiguration(pwmRequest);
final LDAPPermissionCalculator ldapPermissionCalculator = new LDAPPermissionCalculator(storedConfiguration);
pwmRequest.setAttribute(PwmRequestAttribute.LdapPermissionItems, ldapPermissionCalculator);
pwmRequest.forwardToJsp(JspUrl.CONFIG_MANAGER_PERMISSIONS);
}
use of password.pwm.util.LDAPPermissionCalculator in project pwm by pwm-project.
the class ConfigManagerServlet method downloadPermissionReportCsv.
private void downloadPermissionReportCsv(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException, ChaiUnavailableException, ServletException {
pwmRequest.getPwmResponse().markAsDownload(HttpContentType.csv, pwmRequest.getConfig().readAppProperty(AppProperty.DOWNLOAD_FILENAME_LDAP_PERMISSION_CSV));
final CSVPrinter csvPrinter = JavaHelper.makeCsvPrinter(pwmRequest.getPwmResponse().getOutputStream());
try {
final StoredConfigurationImpl storedConfiguration = readCurrentConfiguration(pwmRequest);
final LDAPPermissionCalculator ldapPermissionCalculator = new LDAPPermissionCalculator(storedConfiguration);
for (final LDAPPermissionCalculator.PermissionRecord permissionRecord : ldapPermissionCalculator.getPermissionRecords()) {
final String settingTxt = permissionRecord.getPwmSetting() == null ? LocaleHelper.getLocalizedMessage(Display.Value_NotApplicable, pwmRequest) : permissionRecord.getPwmSetting().toMenuLocationDebug(permissionRecord.getProfile(), pwmRequest.getLocale());
csvPrinter.printRecord(permissionRecord.getActor().getLabel(pwmRequest.getLocale(), pwmRequest.getConfig()), permissionRecord.getAttribute(), permissionRecord.getAccess().toString(), settingTxt);
}
} catch (Exception e) {
final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_UNKNOWN, e.getMessage());
LOGGER.error(pwmRequest, errorInformation);
pwmRequest.respondWithError(errorInformation);
} finally {
IOUtils.closeQuietly(csvPrinter);
}
}
Aggregations