Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Free disk space
run: curl -fsSL https://raw.githubusercontent.com/kou/arrow/e49d8ae15583ceff03237571569099a6ad62be32/ci/scripts/util_free_space.sh | bash
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Java JDK
Expand Down
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ under the License.
<extension>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-build-cache-extension</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</extension>
</extensions>
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected ActionsPanel<AMSession> getActions(final IModel<AMSession> model) {
public void onClick(final AjaxRequestTarget target, final AMSession ignore) {
viewModal.header(new ResourceModel("details"));
target.add(viewModal.setContent(
new JsonEditorPanel(viewModal, Model.of(model.getObject().getJson()), true, pageRef)));
new JsonEditorPanel(viewModal, Model.of(model.getObject().getJson()), true, pageRef)));
viewModal.show(true);
}
}, ActionLink.ActionType.VIEW, listEntitlement);
Expand Down Expand Up @@ -167,8 +167,7 @@ protected String paginatorRowsKey() {

@Override
public void onEvent(final IEvent<?> event) {
if (event.getPayload() instanceof AMSessionSearchEvent) {
AMSessionSearchEvent payload = AMSessionSearchEvent.class.cast(event.getPayload());
if (event.getPayload() instanceof AMSessionSearchEvent payload) {
keyword = payload.getKeyword();

updateResultTable(payload.getTarget());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public LinkedAccountModalPanel(
roleRestClient,
anyTypeRestClient.listAnyTypes().stream().map(AnyTypeTO::getKey).collect(Collectors.toList()));
LinkedAccountFormLayoutInfo linkedAccountFormLayoutInfo =
anyLayout.getUser() instanceof IdMUserFormLayoutInfo
? IdMUserFormLayoutInfo.class.cast(anyLayout.getUser()).getLinkedAccountFormLayoutInfo()
anyLayout.getUser() instanceof IdMUserFormLayoutInfo idMUFLI
? idMUFLI.getLinkedAccountFormLayoutInfo()
: new LinkedAccountFormLayoutInfo();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ public RemediationProvider(final int paginatorRows) {
@Override
public Iterator<RemediationTO> iterator(final long first, final long count) {
int page = ((int) first / paginatorRows);
return restClient.getRemediations((page < 0 ? 0 : page) + 1,
paginatorRows, getSort()).iterator();
return restClient.getRemediations((page < 0 ? 0 : page) + 1, paginatorRows, getSort()).iterator();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,23 @@ protected class CorrelationRulePanel extends Panel {
@Override
public Boolean getObject() {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
return conf instanceof DefaultInboundCorrelationRuleConf
? DefaultInboundCorrelationRuleConf.class.cast(conf).isOrSchemas()
: conf instanceof DefaultPushCorrelationRuleConf
? DefaultPushCorrelationRuleConf.class.cast(conf).isOrSchemas()
return conf instanceof DefaultInboundCorrelationRuleConf dicrc
? dicrc.isOrSchemas()
: conf instanceof DefaultPushCorrelationRuleConf dpcrc
? dpcrc.isOrSchemas()
: false;
}

@Override
public void setObject(final Boolean object) {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
if (conf instanceof DefaultInboundCorrelationRuleConf) {
DefaultInboundCorrelationRuleConf.class.cast(conf).setOrSchemas(object);
} else if (conf instanceof DefaultPushCorrelationRuleConf) {
DefaultPushCorrelationRuleConf.class.cast(conf).setOrSchemas(object);
switch (conf) {
case DefaultInboundCorrelationRuleConf dicrc ->
dicrc.setOrSchemas(object);
case DefaultPushCorrelationRuleConf dpcrc ->
dpcrc.setOrSchemas(object);
default -> {
}
}
}
};
Expand All @@ -244,10 +247,10 @@ public void setObject(final Boolean object) {

private List<String> schemas() {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
return conf instanceof DefaultInboundCorrelationRuleConf
? DefaultInboundCorrelationRuleConf.class.cast(conf).getSchemas()
: conf instanceof DefaultPushCorrelationRuleConf
? DefaultPushCorrelationRuleConf.class.cast(conf).getSchemas()
return conf instanceof DefaultInboundCorrelationRuleConf dicrc
? dicrc.getSchemas()
: conf instanceof DefaultPushCorrelationRuleConf dpcrc
? dpcrc.getSchemas()
: List.of();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ public void onClick(final AjaxRequestTarget target, final StatusBean bean) {
}, ActionLink.ActionType.RECONCILIATION_PULL, IdRepoEntitlement.TASK_EXECUTE);
}

if (anyTO instanceof UserTO && !UserTO.class.cast(anyTO).getLinkedAccounts().isEmpty()) {
UserTO userTO = UserTO.class.cast(anyTO);

if (anyTO instanceof UserTO userTO && userTO.getLinkedAccounts().isEmpty()) {
if (!userTO.getLinkedAccounts().isEmpty()
&& userTO.getLinkedAccounts().stream().anyMatch(linkedAccountTO -> {
return linkedAccountTO.getResource().equals(model.getObject().getResource());
Expand All @@ -272,7 +270,7 @@ public void onClick(final AjaxRequestTarget target, final StatusBean bean) {
@Override
public void onClick(final AjaxRequestTarget target, final StatusBean bean) {
multiLevelPanelRef.next("ACCOUNTS",
new LinkedAccountsStatusModalPanel(Model.of(UserTO.class.cast(anyTO)), pageRef),
new LinkedAccountsStatusModalPanel(Model.of(userTO), pageRef),
target);
target.add(multiLevelPanelRef);
AnyStatusDirectoryPanel.this.getTogglePanel().close(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected void populateItem(final ListItem<URI> item) {
topologynode.setX(x);
topologynode.setY(y);

servers.put(String.class.cast(topologynode.getKey()), topologynode);
servers.put(topologynode.getKey(), topologynode);

item.add(topologyNodePanel("cs", topologynode, false));

Expand Down Expand Up @@ -279,7 +279,7 @@ protected void populateItem(final ListItem<URI> item) {
topologynode.setX(x);
topologynode.setY(y);

servers.put(String.class.cast(topologynode.getKey()), topologynode);
servers.put(topologynode.getKey(), topologynode);

item.add(topologyNodePanel("fp", topologynode, false));

Expand Down Expand Up @@ -336,7 +336,7 @@ protected void populateItem(final ListItem<ConnInstanceTO> item) {
topologynode.setX(x);
topologynode.setY(y);

connectors.put(String.class.cast(topologynode.getKey()), topologynode);
connectors.put(topologynode.getKey(), topologynode);
item.add(topologyNodePanel("conn", topologynode, conn.isErrored()));

// Update connections
Expand Down Expand Up @@ -560,29 +560,26 @@ protected void onEvent(final AjaxRequestTarget target) {
}

@Override
@SuppressWarnings("unchecked")
public void onEvent(final IEvent<?> event) {
super.onEvent(event);

if (event.getPayload() instanceof CreateEvent) {
CreateEvent resourceCreateEvent = CreateEvent.class.cast(event.getPayload());

if (event.getPayload() instanceof CreateEvent payload) {
TopologyNode node = new TopologyNode(
resourceCreateEvent.getKey(),
resourceCreateEvent.getDisplayName(),
resourceCreateEvent.getKind());
payload.getKey(),
payload.getDisplayName(),
payload.getKind());

newlyCreated.getModelObject().add(node);
resourceCreateEvent.getTarget().add(newlyCreatedContainer);
payload.getTarget().add(newlyCreatedContainer);

resourceCreateEvent.getTarget().appendJavaScript(String.format(
payload.getTarget().appendJavaScript(String.format(
"window.Wicket.WebSocket.send('"
+ "{\"kind\":\"%s\",\"target\":\"%s\",\"source\":\"%s\",\"scope\":\"%s\"}"
+ "');",
SupportedOperation.ADD_ENDPOINT,
resourceCreateEvent.getKey(),
resourceCreateEvent.getParent(),
resourceCreateEvent.getKind()));
payload.getKey(),
payload.getParent(),
payload.getKind()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private Fragment getConnectorFragment(final TopologyNode node, final PageReferen
@Override
public void onClick(final AjaxRequestTarget target) {
try {
connectorRestClient.delete(String.class.cast(node.getKey()));
connectorRestClient.delete(node.getKey());
target.appendJavaScript(String.format("jsPlumb.remove('%s');", node.getKey()));
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
toggle(target, false);
Expand All @@ -260,7 +260,7 @@ public void onClick(final AjaxRequestTarget target) {
@Override
public void onClick(final AjaxRequestTarget target) {
final ResourceTO modelObject = new ResourceTO();
modelObject.setConnector(String.class.cast(node.getKey()));
modelObject.setConnector(node.getKey());
modelObject.setConnectorDisplayName(node.getDisplayName());

final IModel<ResourceTO> model = new CompoundPropertyModel<>(modelObject);
Expand Down Expand Up @@ -289,7 +289,7 @@ public String getAjaxIndicatorMarkupId() {

@Override
public void onClick(final AjaxRequestTarget target) {
ConnInstanceTO connInstance = connectorRestClient.read(String.class.cast(node.getKey()));
ConnInstanceTO connInstance = connectorRestClient.read(node.getKey());

final IModel<ConnInstanceTO> model = new CompoundPropertyModel<>(connInstance);
modal.setFormModel(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,102 +20,37 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.image.Icon;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5IconType;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.pages.Remediations;
import org.apache.syncope.client.console.rest.RemediationRestClient;
import org.apache.syncope.client.console.wicket.ajax.IndicatorAjaxTimerBehavior;
import org.apache.syncope.client.ui.commons.annotations.ExtWidget;
import org.apache.syncope.common.lib.to.RemediationTO;
import org.apache.syncope.common.lib.types.IdMEntitlement;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

@ExtWidget(priority = 0)
public class RemediationsWidget extends ExtAlertWidget<RemediationTO> {
public class RemediationsWidget extends ExtAlertWidget {

private static final long serialVersionUID = 1817429725840355068L;

@SpringBean
protected RemediationRestClient remediationRestClient;

protected final List<RemediationTO> lastRemediations = new ArrayList<>();
protected final boolean authorized;

public RemediationsWidget(final String id, final PageReference pageRef) {
super(id, pageRef);
setOutputMarkupId(true);

latestAlertsList.add(new IndicatorAjaxTimerBehavior(Duration.of(30, ChronoUnit.SECONDS)) {

private static final long serialVersionUID = 7298597675929755960L;

@Override
protected void onTimer(final AjaxRequestTarget target) {
if (!latestAlerts.getObject().equals(lastRemediations)) {
refreshLatestAlerts(target);
}
}
});
}

public final void refreshLatestAlerts(final AjaxRequestTarget target) {
latestAlerts.getObject().clear();
latestAlerts.getObject().addAll(lastRemediations);

long latestAlertSize = getLatestAlertsSize();
linkAlertsNumber.setDefaultModelObject(latestAlertSize);
target.add(linkAlertsNumber);

headerAlertsNumber.setDefaultModelObject(latestAlertSize);
target.add(headerAlertsNumber);

target.add(latestAlertsList);

lastRemediations.clear();
lastRemediations.addAll(latestAlerts.getObject());
authorized = SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_LIST);
}

@Override
protected long getLatestAlertsSize() {
return SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_LIST)
&& SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_READ)
? remediationRestClient.countRemediations()
: 0L;
}

@Override
protected IModel<List<RemediationTO>> getLatestAlerts() {
return new ListModel<>() {

private static final long serialVersionUID = 541491929575585613L;

@Override
public List<RemediationTO> getObject() {
List<RemediationTO> updatedRemediations;
if (SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_LIST)
&& SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_READ)) {

updatedRemediations = remediationRestClient.getRemediations(
1, MAX_SIZE, new SortParam<>("instant", true));
} else {
updatedRemediations = List.of();
}

return updatedRemediations;
}
};
return authorized ? remediationRestClient.countRemediations() : 0L;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ private void fixPlainAttrs(final LinkedAccountTO linkedAccountTO) {

@Override
protected Serializable getCreateCustomPayloadEvent(final Serializable afterObject, final AjaxRequestTarget target) {
LinkedAccountTO linkedAccountTO = LinkedAccountTO.class.cast(afterObject);
return new CreateEvent(
linkedAccountTO.getConnObjectKeyValue(),
LinkedAccountTO.class.cast(afterObject).getConnObjectKeyValue(),
model.getObject(),
target);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.Component;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.IEvent;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -97,16 +96,12 @@ public MergeLinkedAccountsSearchPanel(

@Override
public void onEvent(final IEvent<?> event) {
if (event.getPayload() instanceof SearchClausePanel.SearchEvent) {
AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
if (event.getPayload() instanceof SearchClausePanel.SearchEvent payload) {
String fiql = "username!~" + wizardModel.getBaseUser().getUsername() + ';'
+ SearchUtils.buildFIQL(userSearchPanel.getModel().getObject(),
SyncopeClient.getUserSearchConditionBuilder());
userDirectoryPanel.search(fiql, target);
} else if (event.getPayload() instanceof final AnySelectionDirectoryPanel.ItemSelection itemSelection) {
AnySelectionDirectoryPanel.ItemSelection<?> payload =
itemSelection;

userDirectoryPanel.search(fiql, payload.getTarget());
} else if (event.getPayload() instanceof final AnySelectionDirectoryPanel.ItemSelection payload) {
AnyTO sel = payload.getSelection();
wizardModel.setMergingUser(userRestClient.read(sel.getKey()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnLoadHeaderItem;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.PasswordTextField;
Expand Down Expand Up @@ -108,15 +107,6 @@ public BaseLogin(final PageParameters parameters) {
: parameters.get(Constants.NOTIFICATION_LEVEL_PARAM).toString();
}

Label exceptionMessage = new Label("exceptionMessage");
exceptionMessage.setOutputMarkupPlaceholderTag(true);
exceptionMessage.setVisible(false);
if (!parameters.get("errorMessage").isNull()) {
exceptionMessage.setVisible(true);
exceptionMessage.setDefaultModel(Model.of(parameters.get("errorMessage")));
}
add(exceptionMessage);

form = new StatelessForm<>("login");

usernameField = new TextField<>("username", new Model<>());
Expand Down
Loading
Loading