in client/idm/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDirectoryPanel.java [176:395]
public ActionsPanel<Serializable> getActions(final IModel<Serializable> model) {
ActionsPanel<Serializable> panel = super.getActions(model);
String key = ((ResourceTO) model.getObject()).getKey();
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -7220222653598674870L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
ResourceTO resource = restClient.read(key);
ConnInstanceTO connInstance = connectorRestClient.read(resource.getConnector());
IModel<ResourceTO> model = new CompoundPropertyModel<>(resource);
modal.setFormModel(model);
target.add(modal.setContent(new ResourceWizardBuilder(
resource, restClient, connectorRestClient, pageRef).
build(BaseModal.CONTENT_ID,
SyncopeConsoleSession.get().
owns(IdMEntitlement.RESOURCE_UPDATE, connInstance.getAdminRealm())
? AjaxWizard.Mode.EDIT
: AjaxWizard.Mode.READONLY)));
modal.header(new Model<>(MessageFormat.format(getString("resource.edit"), model.getObject().getKey())));
modal.show(true);
}
}, ActionLink.ActionType.EDIT,
String.format("%s,%s", IdMEntitlement.RESOURCE_READ, IdMEntitlement.RESOURCE_UPDATE));
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -6467344504797047254L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
ResourceTO resource = restClient.read(key);
ConnInstanceTO connInstance = connectorRestClient.read(resource.getConnector());
if (SyncopeConsoleSession.get().
owns(IdMEntitlement.RESOURCE_UPDATE, connInstance.getAdminRealm())) {
provisionModal.addSubmitButton();
} else {
provisionModal.removeSubmitButton();
}
IModel<ResourceTO> model = new CompoundPropertyModel<>(resource);
provisionModal.setFormModel(model);
target.add(provisionModal.setContent(
new ResourceProvisionPanel(provisionModal, resource, connInstance.getAdminRealm(), pageRef)));
provisionModal.header(new Model<>(MessageFormat.format(getString("resource.edit"),
model.getObject().getKey())));
provisionModal.show(true);
}
}, ActionLink.ActionType.MAPPING,
String.format("%s,%s", IdMEntitlement.RESOURCE_READ, IdMEntitlement.RESOURCE_UPDATE));
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -1448897313753684142L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
ResourceTO resource = restClient.read(key);
target.add(propTaskModal.setContent(new ConnObjects(resource, pageRef)));
propTaskModal.header(new StringResourceModel("resource.explore.list", Model.of(model.getObject())));
propTaskModal.show(true);
}
}, ActionLink.ActionType.EXPLORE_RESOURCE, IdMEntitlement.RESOURCE_LIST_CONNOBJECT);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = 4800323783814856195L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
target.add(propTaskModal.setContent(new PropagationTasks(propTaskModal, key, pageRef)));
propTaskModal.header(new Model<>(MessageFormat.format(getString("task.propagation.list"), key)));
propTaskModal.show(true);
}
}, ActionLink.ActionType.PROPAGATION_TASKS, IdRepoEntitlement.TASK_LIST);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -4699610013584898667L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
target.add(schedTaskModal.setContent(new PullTasks(schedTaskModal, key, pageRef)));
schedTaskModal.header(new Model<>(MessageFormat.format(getString("task.pull.list"), key)));
schedTaskModal.show(true);
}
}, ActionLink.ActionType.PULL_TASKS, IdRepoEntitlement.TASK_LIST);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -4699610013584898667L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
target.add(schedTaskModal.setContent(new LiveSyncTask(schedTaskModal, key, pageRef)));
schedTaskModal.header(new Model<>(MessageFormat.format(getString("task.livesync"), key)));
schedTaskModal.show(true);
}
}, ActionLink.ActionType.LIVE_SYNC_TASK, IdRepoEntitlement.TASK_READ);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = 2042227976628604686L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
target.add(schedTaskModal.setContent(new PushTasks(schedTaskModal, key, pageRef)));
schedTaskModal.header(new Model<>(MessageFormat.format(getString("task.push.list"), key)));
schedTaskModal.show(true);
}
}, ActionLink.ActionType.PUSH_TASKS, IdRepoEntitlement.TASK_LIST);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -5962061673680621813L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
ResourceTO modelObject = restClient.read(key);
target.add(propTaskModal.setContent(new ResourceStatusModal(pageRef, modelObject)));
propTaskModal.header(new Model<>(MessageFormat.format(getString("resource.reconciliation"), key)));
propTaskModal.show(true);
}
}, ActionLink.ActionType.RECONCILIATION_RESOURCE, IdRepoEntitlement.USER_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -5432034353017728766L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
ResourceTO modelObject = restClient.read(key);
target.add(historyModal.setContent(new AuditHistoryModal<>(
OpEvent.CategoryType.LOGIC,
"ResourceLogic",
modelObject,
IdMEntitlement.RESOURCE_UPDATE,
auditRestClient) {
private static final long serialVersionUID = -3712506022627033811L;
@Override
protected void restore(final String json, final AjaxRequestTarget target) {
try {
ResourceTO updated = MAPPER.readValue(json, ResourceTO.class);
restClient.update(updated);
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
} catch (Exception e) {
LOG.error("While restoring resource {}", key, e);
SyncopeConsoleSession.get().onException(e);
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}));
historyModal.header(
new Model<>(MessageFormat.format(getString("resource.menu.history"),
key)));
historyModal.show(true);
}
}, ActionLink.ActionType.VIEW_AUDIT_HISTORY,
String.format("%s,%s", IdMEntitlement.RESOURCE_READ, IdRepoEntitlement.AUDIT_LIST));
panel.add(new ActionLink<>() {
private static final long serialVersionUID = 7019899256702149874L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
try {
ResourceTO resource = restClient.read(key);
resource.setKey("Copy of " + resource.getKey());
// reset some resource objects keys
target.add(modal.setContent(new ResourceWizardBuilder(
resource, restClient, connectorRestClient, pageRef).
build(BaseModal.CONTENT_ID, AjaxWizard.Mode.CREATE)));
modal.header(new Model<>(MessageFormat.format(getString("resource.clone"), resource.getKey())));
modal.show(true);
} catch (SyncopeClientException e) {
LOG.error("While cloning resource {}", key, e);
SyncopeConsoleSession.get().onException(e);
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.CLONE, IdMEntitlement.RESOURCE_CREATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = 4516186028545701573L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
try {
restClient.delete(key);
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientException e) {
LOG.error("While deleting resource {}", key, e);
SyncopeConsoleSession.get().onException(e);
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, IdMEntitlement.RESOURCE_DELETE, true);
return panel;
}