Skip to content

fix: update plugin due to removal of associatedPerson in DB schema #17 #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2022
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: 1 addition & 1 deletion casa/extras/Casa.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def getGeolocation(self, identity):

session_attributes = identity.getSessionId().getSessionAttributes()
if session_attributes.containsKey("remote_ip"):
remote_ip = session_attributes.get("remote_ip")
remote_ip = session_attributes.get("remote_ip").split(",", 2)[0].strip()
if StringHelper.isNotEmpty(remote_ip):

httpService = CdiUtil.bean(HttpService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.gluu.casa.core.model.Client;
import org.gluu.casa.core.model.Scope;
import org.gluu.casa.plugins.consent.service.ClientAuthorizationsService;
import org.gluu.casa.plugins.consent.service.ClientService;
import org.gluu.casa.core.pojo.User;
import org.gluu.casa.service.ISessionContext;
import org.gluu.casa.ui.UIUtils;
Expand All @@ -30,7 +29,6 @@ public class AuthorizedClientsVM {
private ISessionContext sessionContext;

private User user;
private ClientService clientService;
private ClientAuthorizationsService caService;
private Map<Client, Set<Scope>> clients;

Expand All @@ -43,14 +41,9 @@ public void init() {
logger.info("Authorized Clients ViewModel inited");
user = sessionContext.getLoggedUser();
caService = new ClientAuthorizationsService();
clientService = new ClientService();
reloadClients();
}

public String getAssociatedPeopleAsCSV(Client client) {
return clientService.getAssociatedPeople(client).stream().collect(Collectors.joining(", "));
}

public String getContactEmailsAsCSV(Client client) {
return client.getContacts().stream().collect(Collectors.joining(", "));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public Map<Client, Set<Scope>> getUserClientPermissions(String userId) {
caSample.setUserId(userId);
List<ClientAuthorization> authorizations = persistenceService.find(caSample);

int caEntries = authorizations.size();
logger.debug("{} client-authorization entries found", caEntries);

if (caEntries == 0) return Collections.emptyMap();

//Obtain client ids from all this user's client authorizations
Set<String> clientIds = authorizations.stream().map(ClientAuthorization::getJansClntId).collect(Collectors.toSet());

Expand Down Expand Up @@ -80,7 +85,7 @@ public void removeClientAuthorizations(String userId, String userName, String cl

logger.info("Removing client authorizations for user {}", userName);
//Here we ignore the return value of deletion
persistenceService.find(caSample).forEach(auth -> persistenceService.delete(auth));
persistenceService.find(caSample).forEach(persistenceService::delete);

Token sampleToken = new Token();
sampleToken.setBaseDn(TOKENS_DN);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
<h:a href="@load(each.key.jansClntURI)" target="_blank">${each.key.jansClntURI}</h:a>
</dd>
</z:div>
<z:div class="flex flex-wrap" visible="@load(not empty vm.getAssociatedPeopleAsCSV(each.key))">
<dt class="w4">${labels.clients.authorized.associated}</dt>
<dd>${vm.getAssociatedPeopleAsCSV(each.key)}</dd>
</z:div>
<z:div class="flex flex-wrap" visible="@load(not empty vm.getContactEmailsAsCSV(each.key))">
<dt class="w4">${labels.clients.authorized.emails}</dt>
<dd>${vm.getContactEmailsAsCSV(each.key)}</dd>
Expand All @@ -67,7 +63,7 @@
<z:div class="flex flex-wrap" visible="@load(not empty each.key.tosURI)">
<dt class="w4">${labels.clients.authorized.tos}</dt>
<dd>
<h:href href="@load(each.key.tosURI)">${each.key.tosURI}</h:href>
<h:a href="@load(each.key.tosURI)">${each.key.tosURI}</h:a>
</dd>
</z:div>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ clients.authorized.panel_text=You have granted {0} applications access to your a
clients.authorized.panel_text_noapps=There are no authorized applications currently.

clients.authorized.homepage=Client homepage
clients.authorized.associated=Associated people
clients.authorized.emails=Contact email(s)
clients.authorized.policy=Policy
clients.authorized.tos=Terms of service
Expand Down
11 changes: 0 additions & 11 deletions casa/shared/src/main/java/org/gluu/casa/core/model/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
@ObjectClass("jansClnt")
public class Client extends InumEntry {

@AttributeName(name = "associatedPerson")
private List<String> associatedPeople;

@AttributeName
private String displayName;

Expand Down Expand Up @@ -46,10 +43,6 @@ public void setJansClntIdIssuedAt(String jansClntIdIssuedAt) {
this.jansClntIdIssuedAt = jansClntIdIssuedAt;
}

public List<String> getAssociatedPeople() {
return Utils.nonNullList(associatedPeople);
}

public String getDisplayName() {
return displayName;
}
Expand Down Expand Up @@ -83,10 +76,6 @@ public String getAlternativeID() {
.map(str -> str.replaceAll("\\W","")).orElse (null);
}

public void setAssociatedPeople(List<String> associatedPeople) {
this.associatedPeople = associatedPeople;
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}
Expand Down