mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-06-22 22:21:41 +02:00
added field to user for active state
This commit is contained in:
@@ -216,6 +216,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
&& Objects.equal(mail, other.mail)
|
||||
&& Objects.equal(type, other.type)
|
||||
&& Objects.equal(admin, other.admin)
|
||||
&& Objects.equal(active, other.active)
|
||||
&& Objects.equal(password, other.password)
|
||||
&& Objects.equal(creationDate, other.creationDate)
|
||||
&& Objects.equal(lastModified, other.lastModified)
|
||||
@@ -232,7 +233,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(name, displayName, mail, type, admin, password,
|
||||
creationDate, lastModified, properties);
|
||||
active, creationDate, lastModified, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,6 +257,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
.add("password", pwd)
|
||||
.add("admin", admin)
|
||||
.add("type", type)
|
||||
.add("active", active)
|
||||
.add("creationDate", creationDate)
|
||||
.add("lastModified", lastModified)
|
||||
.add("properties", properties)
|
||||
@@ -357,6 +359,18 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the user is deactivated.
|
||||
*
|
||||
*
|
||||
* @return false if the user is deactivated
|
||||
* @since 1.16
|
||||
*/
|
||||
public boolean isActive()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -384,6 +398,18 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Activate or deactive this user.
|
||||
*
|
||||
*
|
||||
* @param active false to deactivate the user.
|
||||
* @since 1.6
|
||||
*/
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -476,7 +502,10 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private boolean admin;
|
||||
private boolean active = true;
|
||||
|
||||
/** Field description */
|
||||
private boolean admin = false;
|
||||
|
||||
/** Field description */
|
||||
private Long creationDate;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.user.orientdb;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -59,6 +60,9 @@ public class UserConverter extends AbstractConverter implements Converter<User>
|
||||
/** Field description */
|
||||
public static final String DOCUMENT_CLASS = "User";
|
||||
|
||||
/** Field description */
|
||||
public static final String FIELD_ACTIVE = "active";
|
||||
|
||||
/** Field description */
|
||||
public static final String FIELD_ADMIN = "admin";
|
||||
|
||||
@@ -115,6 +119,7 @@ public class UserConverter extends AbstractConverter implements Converter<User>
|
||||
appendField(doc, FIELD_MAIL, user.getMail());
|
||||
appendField(doc, FIELD_PASSWORD, user.getPassword());
|
||||
appendField(doc, FIELD_ADMIN, user.isAdmin());
|
||||
appendField(doc, FIELD_ACTIVE, user.isActive());
|
||||
appendField(doc, FIELD_CREATIONDATE, user.getCreationDate(), OType.LONG);
|
||||
appendPropertiesField(doc, user);
|
||||
|
||||
@@ -140,6 +145,7 @@ public class UserConverter extends AbstractConverter implements Converter<User>
|
||||
user.setPassword(getStringField(doc, FIELD_PASSWORD));
|
||||
user.setType(getStringField(doc, FIELD_TYPE));
|
||||
user.setAdmin(getBooleanField(doc, FIELD_ADMIN));
|
||||
user.setAdmin(getBooleanField(doc, FIELD_ACTIVE));
|
||||
user.setLastModified(getLongField(doc, FIELD_LASTMODIFIED));
|
||||
user.setCreationDate(getLongField(doc, FIELD_CREATIONDATE));
|
||||
|
||||
@@ -176,6 +182,7 @@ public class UserConverter extends AbstractConverter implements Converter<User>
|
||||
oclass.createProperty(FIELD_CREATIONDATE, OType.LONG);
|
||||
oclass.createProperty(FIELD_DISPLAYNAME, OType.STRING);
|
||||
oclass.createProperty(FIELD_MAIL, OType.STRING);
|
||||
oclass.createProperty(FIELD_ACTIVE, OType.STRING);
|
||||
oclass.createProperty(FIELD_PASSWORD, OType.STRING);
|
||||
oclass.createProperty(FIELD_PROPERTIES, OType.EMBEDDEDMAP);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user