in client/am/console/src/main/java/org/apache/syncope/client/console/authprofiles/AuthProfileDirectoryPanel.java [175:443]
public ActionsPanel<AuthProfileTO> getActions(final IModel<AuthProfileTO> model) {
ActionsPanel<AuthProfileTO> panel = super.getActions(model);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
model.setObject(restClient.read(model.getObject().getKey()));
target.add(authProfileModal.setContent(new ModalDirectoryPanel<>(
authProfileModal,
new AuthProfileItemDirectoryPanel<ImpersonationAccount>(
"panel", restClient, authProfileModal, model.getObject(), pageRef) {
private static final long serialVersionUID = -5380664539000792237L;
@Override
protected List<ImpersonationAccount> getItems() {
return model.getObject().getImpersonationAccounts();
}
@Override
protected ImpersonationAccount defaultItem() {
return new ImpersonationAccount();
}
@Override
protected String sortProperty() {
return "impersonated";
}
@Override
protected String paginatorRowsKey() {
return AMConstants.PREF_AUTHPROFILE_IMPERSONATED_PAGINATOR_ROWS;
}
@Override
protected List<IColumn<ImpersonationAccount, String>> getColumns() {
List<IColumn<ImpersonationAccount, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("impersonated"),
"impersonated", "impersonated"));
return columns;
}
}, pageRef)));
authProfileModal.header(new Model<>(getString("impersonationAccounts", model)));
authProfileModal.show(true);
}
}, ActionLink.ActionType.TYPE_EXTENSIONS, AMEntitlement.AUTH_PROFILE_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
model.setObject(restClient.read(model.getObject().getKey()));
target.add(authProfileModal.setContent(new ModalDirectoryPanel<>(
authProfileModal,
new AuthProfileItemDirectoryPanel<GoogleMfaAuthToken>(
"panel", restClient, authProfileModal, model.getObject(), pageRef) {
private static final long serialVersionUID = 7332357430197837993L;
@Override
protected List<GoogleMfaAuthToken> getItems() {
return model.getObject().getGoogleMfaAuthTokens();
}
@Override
protected GoogleMfaAuthToken defaultItem() {
return new GoogleMfaAuthToken();
}
@Override
protected String sortProperty() {
return "issueDate";
}
@Override
protected String paginatorRowsKey() {
return AMConstants.PREF_AUTHPROFILE_GOOGLEMFAAUTHTOKENS_PAGINATOR_ROWS;
}
@Override
protected List<IColumn<GoogleMfaAuthToken, String>> getColumns() {
List<IColumn<GoogleMfaAuthToken, String>> columns = new ArrayList<>();
columns.add(new DatePropertyColumn<>(
new ResourceModel("issueDate"), "issueDate", "issueDate"));
columns.add(new PropertyColumn<>(
new ResourceModel("otp"), "otp", "otp"));
return columns;
}
}, pageRef)));
authProfileModal.header(new Model<>(getString("googleMfaAuthTokens", model)));
authProfileModal.show(true);
}
}, ActionLink.ActionType.EDIT_APPROVAL, AMEntitlement.AUTH_PROFILE_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
model.setObject(restClient.read(model.getObject().getKey()));
target.add(authProfileModal.setContent(new ModalDirectoryPanel<>(
authProfileModal,
new AuthProfileItemDirectoryPanel<GoogleMfaAuthAccount>(
"panel", restClient, authProfileModal, model.getObject(), pageRef) {
private static final long serialVersionUID = -670769282358547044L;
@Override
protected List<GoogleMfaAuthAccount> getItems() {
return model.getObject().getGoogleMfaAuthAccounts();
}
@Override
protected GoogleMfaAuthAccount defaultItem() {
return new GoogleMfaAuthAccount();
}
@Override
protected String sortProperty() {
return "id";
}
@Override
protected String paginatorRowsKey() {
return AMConstants.PREF_AUTHPROFILE_GOOGLEMFAAUTHACCOUNTS_PAGINATOR_ROWS;
}
@Override
protected List<IColumn<GoogleMfaAuthAccount, String>> getColumns() {
List<IColumn<GoogleMfaAuthAccount, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("id"), "id", "id"));
columns.add(new DatePropertyColumn<>(
new ResourceModel("registrationDate"), "registrationDate", "registrationDate"));
columns.add(new PropertyColumn<>(new ResourceModel("name"), "name", "name"));
return columns;
}
}, pageRef)));
authProfileModal.header(new Model<>(getString("googleMfaAuthAccounts", model)));
authProfileModal.show(true);
}
}, ActionLink.ActionType.EXECUTE, AMEntitlement.AUTH_PROFILE_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
model.setObject(restClient.read(model.getObject().getKey()));
target.add(authProfileModal.setContent(new ModalDirectoryPanel<>(
authProfileModal,
new AuthProfileItemDirectoryPanel<MfaTrustedDevice>(
"panel", restClient, authProfileModal, model.getObject(), pageRef) {
private static final long serialVersionUID = 5788448799796630011L;
@Override
protected List<MfaTrustedDevice> getItems() {
return model.getObject().getMfaTrustedDevices();
}
@Override
protected MfaTrustedDevice defaultItem() {
return new MfaTrustedDevice();
}
@Override
protected String sortProperty() {
return "id";
}
@Override
protected String paginatorRowsKey() {
return AMConstants.PREF_AUTHPROFILE_MFA_TRUSTED_FDEVICES_PAGINATOR_ROWS;
}
@Override
protected List<IColumn<MfaTrustedDevice, String>> getColumns() {
List<IColumn<MfaTrustedDevice, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("id"), "id", "id"));
columns.add(new PropertyColumn<>(new ResourceModel("name"), "name", "name"));
columns.add(new DatePropertyColumn<>(
new ResourceModel("recordDate"), "recordDate", "recordDate"));
columns.add(new DatePropertyColumn<>(
new ResourceModel("expirationDate"), "expirationDate", "expirationDate"));
return columns;
}
}, pageRef)));
authProfileModal.header(new Model<>(getString("mfaTrustedDevices", model)));
authProfileModal.show(true);
}
}, ActionLink.ActionType.DOWN, AMEntitlement.AUTH_PROFILE_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
model.setObject(restClient.read(model.getObject().getKey()));
target.add(authProfileModal.setContent(new ModalDirectoryPanel<>(
authProfileModal,
new AuthProfileItemDirectoryPanel<WebAuthnDeviceCredential>(
"panel", restClient, authProfileModal, model.getObject(), pageRef) {
private static final long serialVersionUID = 6820212423488933184L;
@Override
protected List<WebAuthnDeviceCredential> getItems() {
return model.getObject().getWebAuthnDeviceCredentials();
}
@Override
protected WebAuthnDeviceCredential defaultItem() {
return new WebAuthnDeviceCredential();
}
@Override
protected String sortProperty() {
return "identifier";
}
@Override
protected String paginatorRowsKey() {
return AMConstants.PREF_AUTHPROFILE_WEBAUTHNDEVICECREDENTIALS_PAGINATOR_ROWS;
}
@Override
protected List<IColumn<WebAuthnDeviceCredential, String>> getColumns() {
List<IColumn<WebAuthnDeviceCredential, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(
new ResourceModel("identifier"), "identifier", "identifier"));
columns.add(new PropertyColumn<>(
new ResourceModel("json"), "json", "json"));
return columns;
}
}, pageRef)));
authProfileModal.header(new Model<>(getString("webAuthnDeviceCredentials", model)));
authProfileModal.show(true);
}
}, ActionLink.ActionType.HTML, AMEntitlement.AUTH_PROFILE_UPDATE);
panel.add(new ActionLink<>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final AuthProfileTO ignore) {
try {
restClient.delete(model.getObject().getKey());
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
} catch (Exception e) {
LOG.error("While deleting {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().onException(e);
}
((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, AMEntitlement.AUTH_PROFILE_DELETE, true);
return panel;
}