use of org.apache.syncope.client.console.layout.UserFormLayoutInfo in project syncope by apache.
the class Realm method buildTabList.
private List<ITab> buildTabList(final PageReference pageRef) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new ITabComponent(new Model<>("DETAILS"), StandardEntitlement.REALM_CREATE, StandardEntitlement.REALM_UPDATE, StandardEntitlement.REALM_DELETE) {
private static final long serialVersionUID = -5861786415855103549L;
@Override
public Panel getPanel(final String panelId) {
final ActionsPanel<RealmTO> actionPanel = new ActionsPanel<>("actions", null);
if (realmTO.getFullPath().startsWith(SyncopeConstants.ROOT_REALM)) {
actionPanel.add(new ActionLink<RealmTO>(realmTO) {
private static final long serialVersionUID = 2802988981431379827L;
@Override
public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
onClickCreate(target);
}
}, ActionLink.ActionType.CREATE, StandardEntitlement.REALM_CREATE).hideLabel();
actionPanel.add(new ActionLink<RealmTO>(realmTO) {
private static final long serialVersionUID = 2802988981431379828L;
@Override
public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
onClickEdit(target, realmTO);
}
}, ActionLink.ActionType.EDIT, StandardEntitlement.REALM_UPDATE).hideLabel();
actionPanel.add(new ActionLink<RealmTO>(realmTO) {
private static final long serialVersionUID = 2802988981431379827L;
@Override
public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
onClickTemplate(target);
}
}, ActionLink.ActionType.TEMPLATE, StandardEntitlement.REALM_UPDATE).hideLabel();
actionPanel.add(new ActionLink<RealmTO>(realmTO) {
private static final long serialVersionUID = 2802988981431379829L;
@Override
public void onClick(final AjaxRequestTarget target, final RealmTO ignore) {
onClickDelete(target, realmTO);
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.REALM_DELETE, true).hideLabel();
}
RealmDetails panel = new RealmDetails(panelId, realmTO, actionPanel, false);
panel.setContentEnabled(false);
actionPanel.setEnabled(true);
return panel;
}
@Override
public boolean isVisible() {
return SyncopeConsoleApplication.get().getSecuritySettings().getAuthorizationStrategy().isActionAuthorized(this, RENDER);
}
});
final Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> formLayoutInfo = FormLayoutInfoUtils.fetch(anyTypes.stream().map(EntityTO::getKey).collect(Collectors.toList()));
for (final AnyTypeTO anyType : anyTypes) {
tabs.add(new ITabComponent(new Model<>(anyType.getKey()), String.format("%s_SEARCH", anyType.getKey())) {
private static final long serialVersionUID = 1169585538404171118L;
@Override
public WebMarkupContainer getPanel(final String panelId) {
return new AnyPanel(panelId, anyType, realmTO, formLayoutInfo, true, pageRef);
}
@Override
public boolean isVisible() {
return SyncopeConsoleApplication.get().getSecuritySettings().getAuthorizationStrategy().isActionAuthorized(this, RENDER);
}
});
}
return tabs;
}
use of org.apache.syncope.client.console.layout.UserFormLayoutInfo in project syncope by apache.
the class SAML2IdPsDirectoryPanel method getActions.
@Override
public ActionsPanel<SAML2IdPTO> getActions(final IModel<SAML2IdPTO> model) {
final ActionsPanel<SAML2IdPTO> panel = super.getActions(model);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -7978723352517770645L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
SAML2IdPTO object = restClient.read(model.getObject().getKey());
metadataModal.header(Model.of(object.getName() + " - Metadata"));
metadataModal.setContent(new XMLEditorPanel(metadataModal, Model.of(new String(Base64.decodeBase64(object.getMetadata()))), true, pageRef));
metadataModal.show(true);
target.add(metadataModal);
}
}, ActionLink.ActionType.HTML, SAML2SPEntitlement.IDP_READ);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
SAML2IdPTO object = restClient.read(model.getObject().getKey());
send(SAML2IdPsDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(object, target));
}
}, ActionLink.ActionType.EDIT, SAML2SPEntitlement.IDP_UPDATE);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
final SAML2IdPTO object = restClient.read(model.getObject().getKey());
UserTemplateWizardBuilder builder = new UserTemplateWizardBuilder(object.getUserTemplate(), new AnyTypeRestClient().read(AnyTypeKind.USER.name()).getClasses(), new UserFormLayoutInfo(), pageRef) {
private static final long serialVersionUID = -7978723352517770634L;
@Override
protected Serializable onApplyInternal(final AnyWrapper<UserTO> modelObject) {
object.setUserTemplate(modelObject.getInnerObject());
restClient.update(object);
return modelObject;
}
};
templateModal.header(Model.of(StringUtils.capitalize(new StringResourceModel("template.title", SAML2IdPsDirectoryPanel.this).getString())));
templateModal.setContent(builder.build(BaseModal.CONTENT_ID));
templateModal.show(true);
target.add(templateModal);
}
}, ActionLink.ActionType.TEMPLATE, SAML2SPEntitlement.IDP_UPDATE);
panel.add(new ActionLink<SAML2IdPTO>() {
private static final long serialVersionUID = -5467832321897812767L;
@Override
public void onClick(final AjaxRequestTarget target, final SAML2IdPTO ignore) {
try {
restClient.delete(model.getObject().getKey());
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (SyncopeClientException e) {
LOG.error("While deleting object {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, SAML2SPEntitlement.IDP_DELETE, true);
return panel;
}
Aggregations