Compare commits
2 Commits
v1.2.0-bet
...
v1.2.0-bet
Author | SHA1 | Date | |
---|---|---|---|
|
bd9161ec9b | ||
|
544cab816c |
@@ -19,8 +19,17 @@ matrix:
|
|||||||
localpart: 'appservice-mxisd'
|
localpart: 'appservice-mxisd'
|
||||||
token:
|
token:
|
||||||
hs: 'HS_TOKEN_CHANGE_ME'
|
hs: 'HS_TOKEN_CHANGE_ME'
|
||||||
|
|
||||||
|
synapseSql:
|
||||||
|
enabled: false ## Do not use this line if Synapse is used as an Identity Store
|
||||||
|
type: '<DB TYPE>'
|
||||||
|
connection: '<DB CONNECTION URL>'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `synapseSql` section is used to retrieve display names which are not directly accessible in this mode.
|
||||||
|
For details about `type` and `connection`, see the [relevant documentation](../../stores/synapse.md).
|
||||||
|
If you do not configure it, some placeholders will not be available in the notification, like the Room name.
|
||||||
|
|
||||||
You can also change the default template of the notification using the `generic.matrixId` template option.
|
You can also change the default template of the notification using the `generic.matrixId` template option.
|
||||||
See [the Template generator documentation](../../threepids/notification/template-generator.md) for more info.
|
See [the Template generator documentation](../../threepids/notification/template-generator.md) for more info.
|
||||||
|
|
||||||
|
@@ -79,7 +79,12 @@ public class AppServiceHandler {
|
|||||||
log.info("Got invite for {}", id);
|
log.info("Got invite for {}", id);
|
||||||
|
|
||||||
boolean wasSent = false;
|
boolean wasSent = false;
|
||||||
for (_ThreePid tpid : profiler.getThreepids(mxid)) {
|
List<_ThreePid> tpids = profiler.getThreepids(mxid);
|
||||||
|
if (tpids.isEmpty()) {
|
||||||
|
log.info("No email found in identity stores for {}", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (_ThreePid tpid : tpids) {
|
||||||
if (!StringUtils.equals("email", tpid.getMedium())) {
|
if (!StringUtils.equals("email", tpid.getMedium())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -87,7 +92,12 @@ public class AppServiceHandler {
|
|||||||
log.info("Found an email address to notify about room invitation: {}", tpid.getAddress());
|
log.info("Found an email address to notify about room invitation: {}", tpid.getAddress());
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
profiler.getDisplayName(sender).ifPresent(name -> properties.put("sender_display_name", name));
|
profiler.getDisplayName(sender).ifPresent(name -> properties.put("sender_display_name", name));
|
||||||
|
try {
|
||||||
synapse.getRoomName(roomId).ifPresent(name -> properties.put("room_name", name));
|
synapse.getRoomName(roomId).ifPresent(name -> properties.put("room_name", name));
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.warn("Unable to fetch room name - Did you provide synapse DB information as documented?");
|
||||||
|
log.warn("Underlying error:", e);
|
||||||
|
}
|
||||||
|
|
||||||
IMatrixIdInvite inv = new MatrixIdInvite(roomId, sender, mxid, tpid.getMedium(), tpid.getAddress(), properties);
|
IMatrixIdInvite inv = new MatrixIdInvite(roomId, sender, mxid, tpid.getMedium(), tpid.getAddress(), properties);
|
||||||
notif.sendForInvite(inv);
|
notif.sendForInvite(inv);
|
||||||
|
@@ -62,10 +62,13 @@ public class LdapProfileProvider extends LdapBackend implements ProfileProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<String> getDisplayName(_MatrixID userId) {
|
public Optional<String> getDisplayName(_MatrixID userId) {
|
||||||
|
String uid = buildUidFromMatrixId(userId);
|
||||||
|
log.info("Searching for display name of {}:", uid);
|
||||||
|
|
||||||
try (LdapConnection conn = getConn()) {
|
try (LdapConnection conn = getConn()) {
|
||||||
bind(conn);
|
bind(conn);
|
||||||
|
|
||||||
String searchQuery = buildOrQueryWithFilter(getCfg().getProfile().getFilter(), buildUidFromMatrixId(userId), getUidAtt());
|
String searchQuery = buildOrQueryWithFilter(getCfg().getProfile().getFilter(), uid, getUidAtt());
|
||||||
|
|
||||||
log.debug("Base DN: {}", getBaseDn());
|
log.debug("Base DN: {}", getBaseDn());
|
||||||
log.debug("Query: {}", searchQuery);
|
log.debug("Query: {}", searchQuery);
|
||||||
@@ -74,7 +77,7 @@ public class LdapProfileProvider extends LdapBackend implements ProfileProvider
|
|||||||
while (cursor.next()) {
|
while (cursor.next()) {
|
||||||
Entry entry = cursor.get();
|
Entry entry = cursor.get();
|
||||||
log.info("Found possible match, DN: {}", entry.getDn().getName());
|
log.info("Found possible match, DN: {}", entry.getDn().getName());
|
||||||
Optional<String> v = getAttribute(entry, getAt().getName()).flatMap(uid -> {
|
Optional<String> v = getAttribute(entry, getAt().getName()).flatMap(id -> {
|
||||||
log.info("DN {} is a valid match", entry.getDn().getName());
|
log.info("DN {} is a valid match", entry.getDn().getName());
|
||||||
try {
|
try {
|
||||||
return getAttribute(entry, getAt().getName());
|
return getAttribute(entry, getAt().getName());
|
||||||
@@ -102,7 +105,7 @@ public class LdapProfileProvider extends LdapBackend implements ProfileProvider
|
|||||||
@Override
|
@Override
|
||||||
public List<_ThreePid> getThreepids(_MatrixID userId) {
|
public List<_ThreePid> getThreepids(_MatrixID userId) {
|
||||||
String uid = buildUidFromMatrixId(userId);
|
String uid = buildUidFromMatrixId(userId);
|
||||||
log.info("Looking for display name of {}", uid);
|
log.info("Searching for 3PIDs of {}:", uid);
|
||||||
|
|
||||||
List<_ThreePid> threePids = new ArrayList<>();
|
List<_ThreePid> threePids = new ArrayList<>();
|
||||||
try (LdapConnection conn = getConn()) {
|
try (LdapConnection conn = getConn()) {
|
||||||
|
@@ -23,7 +23,7 @@ package io.kamax.mxisd.backend.ldap.netiq;
|
|||||||
import io.kamax.matrix._MatrixID;
|
import io.kamax.matrix._MatrixID;
|
||||||
import io.kamax.mxisd.backend.ldap.LdapProfileProvider;
|
import io.kamax.mxisd.backend.ldap.LdapProfileProvider;
|
||||||
import io.kamax.mxisd.config.MatrixConfig;
|
import io.kamax.mxisd.config.MatrixConfig;
|
||||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
import io.kamax.mxisd.config.ldap.netiq.NetIqLdapConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class NetIqLdapProfileProvider extends LdapProfileProvider {
|
public class NetIqLdapProfileProvider extends LdapProfileProvider {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public NetIqLdapProfileProvider(LdapConfig cfg, MatrixConfig mxCfg) {
|
public NetIqLdapProfileProvider(NetIqLdapConfig cfg, MatrixConfig mxCfg) {
|
||||||
super(cfg, mxCfg);
|
super(cfg, mxCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,12 +48,13 @@ public class ProfileManager {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void build() {
|
public void build() {
|
||||||
providers = providers.stream()
|
|
||||||
.filter(ProfileProvider::isEnabled)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
log.info("--- Profile providers ---");
|
log.info("--- Profile providers ---");
|
||||||
this.providers.forEach(pp -> log.info("\t- {}", pp.getClass().getSimpleName()));
|
providers = providers.stream()
|
||||||
|
.filter(pp -> {
|
||||||
|
log.info("\t- {} - Is enabled? {}", pp.getClass().getSimpleName(), pp.isEnabled());
|
||||||
|
return pp.isEnabled();
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> List<T> getList(Function<ProfileProvider, List<T>> function) {
|
public <T> List<T> getList(Function<ProfileProvider, List<T>> function) {
|
||||||
|
Reference in New Issue
Block a user