Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ranger.ugsyncutil.model;

public class EntraIdSyncSourceInfo {
private String tenantId;
private String graphBaseUrl;
private String authMode;
private String membershipMode;
private String incrementalSync;
private String groupFilter;

private long totalUsersSynced;
private long totalGroupsSynced;
private long totalUsersDeleted;
private long totalGroupsDeleted;

public String getTenantId() {
return tenantId;
}

public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

public String getGraphBaseUrl() {
return graphBaseUrl;
}

public void setGraphBaseUrl(String graphBaseUrl) {
this.graphBaseUrl = graphBaseUrl;
}

public String getAuthMode() {
return authMode;
}

public void setAuthMode(String authMode) {
this.authMode = authMode;
}

public String getMembershipMode() {
return membershipMode;
}

public void setMembershipMode(String membershipMode) {
this.membershipMode = membershipMode;
}

public String getIncrementalSync() {
return incrementalSync;
}

public void setIncrementalSync(String incrementalSync) {
this.incrementalSync = incrementalSync;
}

public String getGroupFilter() {
return groupFilter;
}

public void setGroupFilter(String groupFilter) {
this.groupFilter = groupFilter;
}

public long getTotalUsersSynced() {
return totalUsersSynced;
}

public void setTotalUsersSynced(long totalUsersSynced) {
this.totalUsersSynced = totalUsersSynced;
}

public long getTotalGroupsSynced() {
return totalGroupsSynced;
}

public void setTotalGroupsSynced(long totalGroupsSynced) {
this.totalGroupsSynced = totalGroupsSynced;
}

public long getTotalUsersDeleted() {
return totalUsersDeleted;
}

public void setTotalUsersDeleted(long totalUsersDeleted) {
this.totalUsersDeleted = totalUsersDeleted;
}

public long getTotalGroupsDeleted() {
return totalGroupsDeleted;
}

public void setTotalGroupsDeleted(long totalGroupsDeleted) {
this.totalGroupsDeleted = totalGroupsDeleted;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
toString(sb);
return sb.toString();
}

public StringBuilder toString(StringBuilder sb) {
sb.append("EntraIdSyncSourceInfo [tenantId= ").append(tenantId);
sb.append(", graphBaseUrl= ").append(graphBaseUrl);
sb.append(", authMode= ").append(authMode);
sb.append(", membershipMode= ").append(membershipMode);
sb.append(", incrementalSync= ").append(incrementalSync);
sb.append(", groupFilter= ").append(groupFilter);
sb.append(", totalUsersSynced= ").append(totalUsersSynced);
sb.append(", totalGroupsSynced= ").append(totalGroupsSynced);
sb.append(", totalUsersDeleted= ").append(totalUsersDeleted);
sb.append(", totalGroupsDeleted= ").append(totalGroupsDeleted);
sb.append("]");
return sb;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class UgsyncAuditInfo {
private LdapSyncSourceInfo ldapSyncSourceInfo;
private UnixSyncSourceInfo unixSyncSourceInfo;
private FileSyncSourceInfo fileSyncSourceInfo;
private EntraIdSyncSourceInfo entraIdSyncSourceInfo;

public Long getNoOfNewUsers() {
return noOfNewUsers;
Expand Down Expand Up @@ -95,6 +96,14 @@ public void setFileSyncSourceInfo(FileSyncSourceInfo fileSyncSourceInfo) {
this.fileSyncSourceInfo = fileSyncSourceInfo;
}

public EntraIdSyncSourceInfo getEntraIdSyncSourceInfo() {
return entraIdSyncSourceInfo;
}

public void setEntraIdSyncSourceInfo(EntraIdSyncSourceInfo entraIdSyncSourceInfo) {
this.entraIdSyncSourceInfo = entraIdSyncSourceInfo;
}

public String getUserName() {
return userName;
}
Expand Down Expand Up @@ -127,6 +136,7 @@ public StringBuilder toString(StringBuilder sb) {
sb.append(", ldapSyncSourceInfo= ").append(ldapSyncSourceInfo);
sb.append(", unixSyncSourceInfo= ").append(unixSyncSourceInfo);
sb.append(", fileSyncSourceInfo= ").append(fileSyncSourceInfo);
sb.append(", entraIdSyncSourceInfo= ").append(entraIdSyncSourceInfo);
sb.append("]");
return sb;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ranger.ugsyncutil.model.graph;

import java.util.Objects;

public final class DeltaEntry<T> {
private final T value;
private final boolean removed;

public DeltaEntry(T value, boolean removed) {
this.value = value;
this.removed = removed;
}

public static <T> DeltaEntry<T> upsert(T value) {
return new DeltaEntry<>(value, false);
}

public static <T> DeltaEntry<T> removed(T value) {
return new DeltaEntry<>(value, true);
}

public T getValue() {
return value;
}

public boolean isRemoved() {
return removed;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DeltaEntry<?> that = (DeltaEntry<?>) o;
return removed == that.removed && Objects.equals(value, that.value);
}

@Override
public int hashCode() {
return Objects.hash(value, removed);
}

@Override
public String toString() {
return "DeltaEntry{removed=" + removed + ", value=" + value + '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ranger.ugsyncutil.model.graph;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public final class DeltaPage<T> {
private final List<DeltaEntry<T>> entries;
private final String deltaLink;
private final boolean resynced;

public DeltaPage(List<DeltaEntry<T>> entries, String deltaLink) {
this(entries, deltaLink, false);
}

public DeltaPage(List<DeltaEntry<T>> entries, String deltaLink, boolean resynced) {
this.entries = entries == null ? Collections.<DeltaEntry<T>>emptyList() : Collections.unmodifiableList(new ArrayList<>(entries));
this.deltaLink = deltaLink;
this.resynced = resynced;
}

public List<DeltaEntry<T>> getEntries() {
return entries;
}

public String getDeltaLink() {
return deltaLink;
}

/**
* True when this page was produced by a forced full resync after the previous delta
* link expired or was invalidated. The caller should treat such a cycle as a
* reconciliation (snapshot-diff delete computation), because a resync does not replay
* {@code @removed} tombstones for objects deleted during the gap.
*/
public boolean isResynced() {
return resynced;
}

public int size() {
return entries.size();
}

public boolean isEmpty() {
return entries.isEmpty();
}

@Override
public String toString() {
return "DeltaPage{entries=" + entries.size() + ", deltaLink=" + (deltaLink == null ? "null" : "present") + '}';
}
}
Loading