public List<ConnBundleTO> getAllBundles() { List<ConnBundleTO> bundles = Collections.<ConnBundleTO>emptyList(); try { bundles = getService(ConnectorService.class).getBundles(SyncopeConsoleSession.get().getLocale().toString()); } catch (SyncopeClientException e) { LOG.error("While getting connector bundles", e); } return bundles; }
protected static <E extends JAXRSService, T> T getObject( final E service, final URI location, final Class<T> resultClass) { WebClient webClient = WebClient.fromClient(WebClient.client(service)); webClient.accept(SyncopeConsoleSession.get().getMediaType()).to(location.toASCIIString(), false); return webClient. header(RESTHeaders.DOMAIN, SyncopeConsoleSession.get().getDomain()). header(HttpHeaders.AUTHORIZATION, "Bearer " + SyncopeConsoleSession.get().getJWT()). get(resultClass); }
@Override public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { IModel<?> date = getDataModel(rowModel); String convertedDate = ""; if (date.getObject() instanceof Date) { convertedDate = SyncopeConsoleSession.get().getDateFormat().format(date.getObject()); } item.add(new Label(componentId, convertedDate)); } }
@Override public void onClick(final AjaxRequestTarget target) { try { fileDownload.initiate(target); } catch (Exception e) { SyncopeConsoleSession.get().error( StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } } };
@Override public Class<? extends Page> getHomePage() { return AuthenticatedWebSession.get().isSignedIn() && SyncopeConsoleSession.get().getSelfTO().isMustChangePassword() ? MustChangePassword.class : Dashboard.class; }
public List<String> getObjectClasses(final String connectorKey) { List<String> result = new ArrayList<>(); ConnectorService service = getService(ConnectorService.class); ConnInstanceTO connInstance = service.read(connectorKey, SyncopeConsoleSession.get().getLocale().getLanguage()); if (connInstance != null) { result.addAll(service.buildObjectClassInfo(connInstance, true).stream(). map(input -> input.getType()).collect(Collectors.toList())); } return result; }
@Override public String getObject() { return model.getObject() == null ? "" : SyncopeConsoleSession.get().getDateFormat().format((Date) model.getObject()); }
public AjaxDateFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) { super(id, name, model, datePattern); field = new AjaxDatePicker("field", model, SyncopeConsoleSession.get().getLocale(), datePattern); add(field.setLabel(new Model<>(name)).setOutputMarkupId(true)); }
@Override public void populateItem( final Item<ICellPopulator<AccessTokenTO>> cellItem, final String componentId, final IModel<AccessTokenTO> model) { JwsJwtCompactConsumer consumer = new JwsJwtCompactConsumer(model.getObject().getBody()); cellItem.add(new Label(componentId, SyncopeConsoleSession.get().getDateFormat().format( new Date(consumer.getJwtClaims().getIssuedAt())))); } });
@Override public List<RemediationTO> getObject() { List<RemediationTO> updatedRemediations; if (SyncopeConsoleSession.get().owns(StandardEntitlement.REMEDIATION_LIST) && SyncopeConsoleSession.get().owns(StandardEntitlement.REMEDIATION_READ)) { updatedRemediations = restClient.getRemediations(1, MAX_SIZE, new SortParam<>("instant", true)); } else { updatedRemediations = Collections.<RemediationTO>emptyList(); } return updatedRemediations; } };
public ConnInstanceTO delete(final String key) { ConnInstanceTO connectorTO = getService(ConnectorService.class). read(key, SyncopeConsoleSession.get().getLocale().toString()); getService(ConnectorService.class).delete(key); return connectorTO; }
@Override public void onSubmit(final AjaxRequestTarget target) { final Pair<Boolean, String> result = check(target); if (result.getLeft()) { SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); } else { SyncopeConsoleSession.get().error(getString("error_connection") + ": " + result.getRight()); } ((BasePage) getPage()).getNotificationPanel().refresh(target); } };
public AjaxDateTimeFieldPanel( final String id, final String name, final IModel<Date> model, final String dateTimePattern) { super(id, name, model, dateTimePattern); // dateTimePattern should be spit into separate date and time pattern strings in order to be passed to the // AjaxDateTimePicker constructor, but there is no safe way to do that - ignoring field = new AjaxDateTimePicker("field", model, SyncopeConsoleSession.get().getLocale()); add(field.setLabel(new Model<>(name)).setOutputMarkupId(true)); }
private void checkAddButton(final String adminRealm) { boolean enabled = SyncopeConsoleSession.get().owns(StandardEntitlement.RESOURCE_UPDATE, adminRealm) && !getAnyTypes().getObject().isEmpty(); addAjaxLink.setVisible(enabled); objectTypeTogglePanel.setEnabled(enabled); } }
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference( new KendoCultureResourceReference(SyncopeConsoleSession.get().getLocale()))); } }
public Logout(final PageParameters parameters) { super(parameters); SyncopeConsoleSession.get().invalidate(); setResponsePage(getApplication().getHomePage()); }
@Override public void onClick(final AjaxRequestTarget target, final PolicyRuleWrapper ignore) { PolicyRuleDirectoryPanel.this.getTogglePanel().close(target); if (model.getObject().getConf() == null) { SyncopeConsoleSession.get().info(getString("noConf")); ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); } else { send(PolicyRuleDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(model.getObject(), target)); } } }, ActionLink.ActionType.EDIT, StandardEntitlement.POLICY_UPDATE);
@Override protected void onUpdate(final AjaxRequestTarget target) { if (selectedResource != null) { String adminRealm = getAdminRealm(selectedResource.getConnector()); if (SyncopeConsoleSession.get().owns(StandardEntitlement.CONNECTOR_READ, adminRealm)) { extAttrName.setChoices(getExtAttrNames()); target.add(extAttrName); } } } });