mind review findings

This commit is contained in:
Eduard Heimbuch
2020-10-28 08:42:13 +01:00
parent c1a018a00d
commit 76dac8bc6b
3 changed files with 11 additions and 7 deletions

View File

@@ -80,7 +80,7 @@ public final class SyncingRealmHelper {
* @param ctx administration context * @param ctx administration context
* @param userManager user manager * @param userManager user manager
* @param groupManager group manager * @param groupManager group manager
* @deprecated * @deprecated Use the other constructor including {@link ExternalUserConverter} instead.
*/ */
@Deprecated @Deprecated
public SyncingRealmHelper(AdministrationContext ctx, UserManager userManager, GroupManager groupManager) { public SyncingRealmHelper(AdministrationContext ctx, UserManager userManager, GroupManager groupManager) {

View File

@@ -26,14 +26,18 @@ package sonia.scm.user;
import sonia.scm.plugin.ExtensionPoint; import sonia.scm.plugin.ExtensionPoint;
/**
* The external user converter can be used to modify users
* which are provided by external systems before creation in SCM-Manager.
* The implementations will be called in the {@link sonia.scm.security.SyncingRealmHelper}
* @since 2.9.0
*/
@ExtensionPoint @ExtensionPoint
public interface ExternalUserConverter { public interface ExternalUserConverter {
/** /**
* Returns the converted user. * Returns the converted user.
*
* @return converted user * @return converted user
* @since 2.9.0
*/ */
User convert(User user); User convert(User user);
} }

View File

@@ -167,7 +167,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
return Objects.equal(name, other.name) return Objects.equal(name, other.name)
&& Objects.equal(displayName, other.displayName) && Objects.equal(displayName, other.displayName)
&& Objects.equal(mail, other.mail) && Objects.equal(mail, other.mail)
&& Objects.equal(type, other.type) && Objects.equal(external, other.external)
&& Objects.equal(active, other.active) && Objects.equal(active, other.active)
&& Objects.equal(password, other.password) && Objects.equal(password, other.password)
&& Objects.equal(creationDate, other.creationDate) && Objects.equal(creationDate, other.creationDate)
@@ -177,8 +177,8 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(name, displayName, mail, type, password, return Objects.hashCode(name, displayName, mail, password,
active, creationDate, lastModified, properties); active, external, creationDate, lastModified, properties);
} }
@Override @Override
@@ -195,6 +195,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
.add("password", pwd) .add("password", pwd)
.add("type", type) .add("type", type)
.add("active", active) .add("active", active)
.add("external", external)
.add("creationDate", creationDate) .add("creationDate", creationDate)
.add("lastModified", lastModified) .add("lastModified", lastModified)
.add("properties", properties) .add("properties", properties)
@@ -205,7 +206,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
@Override @Override
public boolean isValid() { public boolean isValid() {
return ValidationUtil.isNameValid(name) && Util.isNotEmpty(displayName) return ValidationUtil.isNameValid(name) && Util.isNotEmpty(displayName)
&& Util.isNotEmpty(type)
&& ((Util.isEmpty(mail)) || ValidationUtil.isMailAddressValid(mail)); && ((Util.isEmpty(mail)) || ValidationUtil.isMailAddressValid(mail));
} }