Commit 2f68fcfe by Nilu

modification to HT012 - enable, disable functionality

parent 552b896d
......@@ -18,6 +18,7 @@
<column name="verification_key" type="String" nullable="true" length="10"/>
<column name="is_account_verified" type="Boolean" nullable="true"/>
<column name="is_email_changed" type="Boolean" nullable="true"/>
<column name="is_disabled" type="Boolean" nullable="true"/>
<column name="user_id" type="Long" length="11" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="true"/>
<column name="default_hiring_team_id" type="Long" length="11" nullable="true"/>
......
......@@ -17,6 +17,7 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
is_disabled char(1) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL,
default_hiring_team_id numeric(12) NULL
......
......@@ -18,6 +18,7 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar2(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
is_disabled char(1) NULL,
user_id number(12) NULL,
company_id number(12) NULL,
default_hiring_team_id number(12) NULL
......
......@@ -18,6 +18,7 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
is_disabled char(1) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL,
default_hiring_team_id numeric(12) NULL
......
package performa.form;
import java.util.Map;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import performa.orm.Company;
import performa.orm.CompanyUser;
import javax.servlet.http.HttpServletRequest;
public class SaveCompanyUserFP extends SaveFP
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
CompanyUser companyUser = (CompanyUser) request.getAttribute("CompanyUser");
Boolean disabled = (Boolean) request.getAttribute("disabled");
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyUserFP saving company user : ", companyUser );
companyUser.setIsDisabled(disabled);
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyUserFP setting is disabled : ", disabled , " for company user : ",companyUser );
return super.processForm(process, submission, params);
}
}
\ No newline at end of file
......@@ -51,6 +51,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
public static final String FIELD_VerificationKey = "VerificationKey";
public static final String FIELD_IsAccountVerified = "IsAccountVerified";
public static final String FIELD_IsEmailChanged = "IsEmailChanged";
public static final String FIELD_IsDisabled = "IsDisabled";
public static final String FIELD_Email = "Email";
public static final String FIELD_Password = "Password";
public static final String FIELD_ConfirmPassword = "ConfirmPassword";
......@@ -76,6 +77,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private static final DefaultAttributeHelper<CompanyUser> HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_IsEmailChanged = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_IsDisabled = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_Email = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_Password = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_ConfirmPassword = DefaultAttributeHelper.INSTANCE;
......@@ -91,6 +93,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private String _VerificationKey;
private Boolean _IsAccountVerified;
private Boolean _IsEmailChanged;
private Boolean _IsDisabled;
private String _Email;
private String _Password;
private String _ConfirmPassword;
......@@ -121,6 +124,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private static final AttributeValidator[] FIELD_VerificationKey_Validators;
private static final AttributeValidator[] FIELD_IsAccountVerified_Validators;
private static final AttributeValidator[] FIELD_IsEmailChanged_Validators;
private static final AttributeValidator[] FIELD_IsDisabled_Validators;
// Arrays of behaviour decorators
......@@ -151,6 +155,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
FIELD_VerificationKey_Validators = (AttributeValidator[])setupAttribMetaData_VerificationKey(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsAccountVerified_Validators = (AttributeValidator[])setupAttribMetaData_IsAccountVerified(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsEmailChanged_Validators = (AttributeValidator[])setupAttribMetaData_IsEmailChanged(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsDisabled_Validators = (AttributeValidator[])setupAttribMetaData_IsDisabled(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_CompanyUser.initialiseReference ();
......@@ -433,6 +438,25 @@ public abstract class BaseCompanyUser extends SecUserExtension
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_IsDisabled(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "is_disabled");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "IsDisabled");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.IsDisabled:", metaInfo);
ATTRIBUTES_METADATA_CompanyUser.put (FIELD_IsDisabled, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(CompanyUser.class, "IsDisabled", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for CompanyUser.IsDisabled:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -469,6 +493,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.initialise (_VerificationKey));
_IsAccountVerified = (Boolean)(Boolean.FALSE);
_IsEmailChanged = (Boolean)(Boolean.FALSE);
_IsDisabled = (Boolean)(Boolean.FALSE);
_Email = (String)(HELPER_Email.initialise (_Email));
_Password = (String)(HELPER_Password.initialise (_Password));
_ConfirmPassword = (String)(HELPER_ConfirmPassword.initialise (_ConfirmPassword));
......@@ -1385,6 +1410,104 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute IsDisabled
*/
public Boolean getIsDisabled ()
{
assertValid();
Boolean valToReturn = _IsDisabled;
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
valToReturn = bhd.getIsDisabled ((CompanyUser)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preIsDisabledChange (Boolean newIsDisabled) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postIsDisabledChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsDisabled ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsDisabled. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsDisabled (Boolean newIsDisabled) throws FieldException
{
boolean oldAndNewIdentical = HELPER_IsDisabled.compare (_IsDisabled, newIsDisabled);
try
{
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
newIsDisabled = bhd.setIsDisabled ((CompanyUser)this, newIsDisabled);
oldAndNewIdentical = HELPER_IsDisabled.compare (_IsDisabled, newIsDisabled);
}
if (FIELD_IsDisabled_Validators.length > 0)
{
Object newIsDisabledObj = HELPER_IsDisabled.toObject (newIsDisabled);
if (newIsDisabledObj != null)
{
int loopMax = FIELD_IsDisabled_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_IsDisabled);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsDisabled_Validators[v].checkAttribute (this, FIELD_IsDisabled, metadata, newIsDisabledObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_IsDisabled () != FieldWriteability.FALSE, "Field IsDisabled is not writeable");
preIsDisabledChange (newIsDisabled);
markFieldChange (FIELD_IsDisabled);
_IsDisabled = newIsDisabled;
postFieldChange (FIELD_IsDisabled);
postIsDisabledChange ();
}
}
/**
* Get the attribute Email
*/
public String getEmail ()
......@@ -2322,6 +2445,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationKey, HELPER_VerificationKey.toObject (_VerificationKey)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject (_IsAccountVerified)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject (_IsEmailChanged)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_IsDisabled, HELPER_IsDisabled.toObject (_IsDisabled)); //
_Company.getPersistentSets (allSets);
_DefaultHiringTeam.getPersistentSets (allSets);
......@@ -2347,6 +2471,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.fromObject (_VerificationKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationKey))); //
_IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsAccountVerified))); //
_IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsEmailChanged))); //
_IsDisabled = (Boolean)(HELPER_IsDisabled.fromObject (_IsDisabled, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsDisabled))); //
_Company.setFromPersistentSets (objectID, allSets);
_DefaultHiringTeam.setFromPersistentSets (objectID, allSets);
......@@ -2445,6 +2570,15 @@ public abstract class BaseCompanyUser extends SecUserExtension
e.addException (ex);
}
try
{
setIsDisabled (otherCompanyUser.getIsDisabled ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -2469,6 +2603,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = sourceCompanyUser._VerificationKey;
_IsAccountVerified = sourceCompanyUser._IsAccountVerified;
_IsEmailChanged = sourceCompanyUser._IsEmailChanged;
_IsDisabled = sourceCompanyUser._IsDisabled;
_Email = sourceCompanyUser._Email;
_Password = sourceCompanyUser._Password;
_ConfirmPassword = sourceCompanyUser._ConfirmPassword;
......@@ -2536,6 +2671,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.readExternal (_VerificationKey, vals.get(FIELD_VerificationKey))); //
_IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.readExternal (_IsAccountVerified, vals.get(FIELD_IsAccountVerified))); //
_IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.readExternal (_IsEmailChanged, vals.get(FIELD_IsEmailChanged))); //
_IsDisabled = (Boolean)(HELPER_IsDisabled.readExternal (_IsDisabled, vals.get(FIELD_IsDisabled))); //
_Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
_Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
_ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); //
......@@ -2562,6 +2698,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
vals.put (FIELD_VerificationKey, HELPER_VerificationKey.writeExternal (_VerificationKey));
vals.put (FIELD_IsAccountVerified, HELPER_IsAccountVerified.writeExternal (_IsAccountVerified));
vals.put (FIELD_IsEmailChanged, HELPER_IsEmailChanged.writeExternal (_IsEmailChanged));
vals.put (FIELD_IsDisabled, HELPER_IsDisabled.writeExternal (_IsDisabled));
vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword));
......@@ -2617,6 +2754,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
listener.notifyFieldChange(this, other, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(this._IsEmailChanged), HELPER_IsEmailChanged.toObject(otherCompanyUser._IsEmailChanged));
}
if (!HELPER_IsDisabled.compare(this._IsDisabled, otherCompanyUser._IsDisabled))
{
listener.notifyFieldChange(this, other, FIELD_IsDisabled, HELPER_IsDisabled.toObject(this._IsDisabled), HELPER_IsDisabled.toObject(otherCompanyUser._IsDisabled));
}
// Compare single assocs
_Company.compare (otherCompanyUser._Company, listener);
......@@ -2654,6 +2795,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
visitor.visitField(this, FIELD_VerificationKey, HELPER_VerificationKey.toObject(getVerificationKey()));
visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified()));
visitor.visitField(this, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(getIsEmailChanged()));
visitor.visitField(this, FIELD_IsDisabled, HELPER_IsDisabled.toObject(getIsDisabled()));
visitor.visitAssociation (_Company);
visitor.visitAssociation (_DefaultHiringTeam);
visitor.visitAssociation (_HiringTeams);
......@@ -2738,6 +2880,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return filter.matches (getIsEmailChanged ());
}
else if (attribName.equals (FIELD_IsDisabled))
{
return filter.matches (getIsDisabled ());
}
else if (attribName.equals (SINGLEREFERENCE_Company))
{
return filter.matches (getCompany ());
......@@ -2831,6 +2977,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchAll andIsDisabled (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
return this;
}
public SearchAll andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -2960,6 +3112,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchAllCompanyUsers andIsDisabled (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
return this;
}
public SearchAllCompanyUsers andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -3096,6 +3254,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchIdPin andIsDisabled (QueryFilter<Boolean> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
return this;
}
public SearchIdPin andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -3185,6 +3349,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return HELPER_IsEmailChanged.toObject (getIsEmailChanged ());
}
else if (attribName.equals (FIELD_IsDisabled))
{
return HELPER_IsDisabled.toObject (getIsDisabled ());
}
else if (attribName.equals (FIELD_Email))
{
return HELPER_Email.toObject (getEmail ());
......@@ -3246,6 +3414,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return HELPER_IsEmailChanged;
}
else if (attribName.equals (FIELD_IsDisabled))
{
return HELPER_IsDisabled;
}
else if (attribName.equals (FIELD_Email))
{
return HELPER_Email;
......@@ -3307,6 +3479,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
setIsEmailChanged ((Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, attribValue)));
}
else if (attribName.equals (FIELD_IsDisabled))
{
setIsDisabled ((Boolean)(HELPER_IsDisabled.fromObject (_IsDisabled, attribValue)));
}
else if (attribName.equals (FIELD_Email))
{
setEmail ((String)(HELPER_Email.fromObject (_Email, attribValue)));
......@@ -3375,6 +3551,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return getWriteability_IsEmailChanged ();
}
else if (fieldName.equals (FIELD_IsDisabled))
{
return getWriteability_IsDisabled ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_HiringTeams))
{
return getWriteability_HiringTeams ();
......@@ -3454,6 +3634,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
fields.add (FIELD_IsEmailChanged);
}
if (getWriteability_IsDisabled () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsDisabled);
}
if (getWriteability_Email () != FieldWriteability.TRUE)
{
fields.add (FIELD_Email);
......@@ -3487,6 +3672,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
result.add(HELPER_VerificationKey.getAttribObject (getClass (), _VerificationKey, false, FIELD_VerificationKey));
result.add(HELPER_IsAccountVerified.getAttribObject (getClass (), _IsAccountVerified, false, FIELD_IsAccountVerified));
result.add(HELPER_IsEmailChanged.getAttribObject (getClass (), _IsEmailChanged, false, FIELD_IsEmailChanged));
result.add(HELPER_IsDisabled.getAttribObject (getClass (), _IsDisabled, false, FIELD_IsDisabled));
result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));
result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password));
result.add(HELPER_ConfirmPassword.getAttribObject (getClass (), _ConfirmPassword, false, FIELD_ConfirmPassword));
......@@ -3703,6 +3889,24 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute IsDisabled
*/
public Boolean getIsDisabled (CompanyUser obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsDisabled.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsDisabled (CompanyUser obj, Boolean newIsDisabled) throws FieldException
{
return newIsDisabled;
}
/**
* Get the attribute Email
*/
public String getEmail (CompanyUser obj, String original)
......@@ -3860,6 +4064,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return toIsEmailChanged ();
}
if (name.equals ("IsDisabled"))
{
return toIsDisabled ();
}
if (name.equals ("Company"))
{
return toCompany ();
......@@ -3897,6 +4105,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
public PipeLine<From, Boolean> toIsAccountVerified () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsAccountVerified)); }
public PipeLine<From, Boolean> toIsEmailChanged () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsEmailChanged)); }
public PipeLine<From, Boolean> toIsDisabled () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsDisabled)); }
public Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); }
public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter)
......
......@@ -180,4 +180,9 @@ public class CompanyUser extends BaseCompanyUser
{
return getRoles() != null && getRoles().contains(role);
}
public boolean isOwner()
{
return CollectionUtils.equals(getCompany().getAddedByUser(), this);
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@
<ATTRIB name="VerificationKey" type="String" dbcol="verification_key" length="10"/>
<ATTRIB name="IsAccountVerified" type="Boolean" dbcol="is_account_verified" defaultValue="Boolean.FALSE"/>
<ATTRIB name="IsEmailChanged" type="Boolean" dbcol="is_email_changed" defaultValue="Boolean.FALSE"/>
<ATTRIB name="IsDisabled" type="Boolean" dbcol="is_disabled" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Users"/>
......
......@@ -37,6 +37,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private String dummyVerificationKey;
private Boolean dummyIsAccountVerified;
private Boolean dummyIsEmailChanged;
private Boolean dummyIsDisabled;
// Static constants corresponding to attribute helpers
......@@ -49,6 +50,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private static final DefaultAttributeHelper HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsEmailChanged = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsDisabled = DefaultAttributeHelper.INSTANCE;
......@@ -64,10 +66,11 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
dummyVerificationKey = (String)(HELPER_VerificationKey.initialise (dummyVerificationKey));
dummyIsAccountVerified = (Boolean)(HELPER_IsAccountVerified.initialise (dummyIsAccountVerified));
dummyIsEmailChanged = (Boolean)(HELPER_IsEmailChanged.initialise (dummyIsEmailChanged));
dummyIsDisabled = (Boolean)(HELPER_IsDisabled.initialise (dummyIsDisabled));
}
private String SELECT_COLUMNS = "{PREFIX}oneit_sec_user_extension.object_id as id, {PREFIX}oneit_sec_user_extension.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}oneit_sec_user_extension.object_CREATED_DATE as CREATED_DATE, {PREFIX}oneit_sec_user_extension.object_TYPE as OBJECT_TYPE, {PREFIX}oneit_sec_user_extension.forgot_password_mail_send_date, {PREFIX}oneit_sec_user_extension.forgot_password_key, {PREFIX}oneit_sec_user_extension.role_type, {PREFIX}oneit_sec_user_extension.roles, {PREFIX}oneit_sec_user_extension.phone, {PREFIX}oneit_sec_user_extension.verification_mail_send_date, {PREFIX}oneit_sec_user_extension.verification_key, {PREFIX}oneit_sec_user_extension.is_account_verified, {PREFIX}oneit_sec_user_extension.is_email_changed, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_id, {PREFIX}oneit_sec_user_extension.default_hiring_team_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}oneit_sec_user_extension.object_id as id, {PREFIX}oneit_sec_user_extension.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}oneit_sec_user_extension.object_CREATED_DATE as CREATED_DATE, {PREFIX}oneit_sec_user_extension.object_TYPE as OBJECT_TYPE, {PREFIX}oneit_sec_user_extension.forgot_password_mail_send_date, {PREFIX}oneit_sec_user_extension.forgot_password_key, {PREFIX}oneit_sec_user_extension.role_type, {PREFIX}oneit_sec_user_extension.roles, {PREFIX}oneit_sec_user_extension.phone, {PREFIX}oneit_sec_user_extension.verification_mail_send_date, {PREFIX}oneit_sec_user_extension.verification_key, {PREFIX}oneit_sec_user_extension.is_account_verified, {PREFIX}oneit_sec_user_extension.is_email_changed, {PREFIX}oneit_sec_user_extension.is_disabled, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_id, {PREFIX}oneit_sec_user_extension.default_hiring_team_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -128,6 +131,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_VerificationKey)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsAccountVerified)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsEmailChanged)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsDisabled)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_User)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_Company)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_DefaultHiringTeam))
......@@ -229,10 +233,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}oneit_sec_user_extension " +
"SET forgot_password_mail_send_date = ?, forgot_password_key = ?, role_type = ?, roles = ?, phone = ?, verification_mail_send_date = ?, verification_key = ?, is_account_verified = ?, is_email_changed = ?, user_id = ? , company_id = ? , default_hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET forgot_password_mail_send_date = ?, forgot_password_key = ?, role_type = ?, roles = ?, phone = ?, verification_mail_send_date = ?, verification_key = ?, is_account_verified = ?, is_email_changed = ?, is_disabled = ?, user_id = ? , company_id = ? , default_hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE oneit_sec_user_extension.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))).listEntry (HELPER_IsDisabled.getForSQL(dummyIsDisabled, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsDisabled))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -658,6 +662,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_VerificationKey, HELPER_VerificationKey.getFromRS(dummyVerificationKey, r, "verification_key"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_IsAccountVerified, HELPER_IsAccountVerified.getFromRS(dummyIsAccountVerified, r, "is_account_verified"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_IsEmailChanged, HELPER_IsEmailChanged.getFromRS(dummyIsEmailChanged, r, "is_email_changed"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_IsDisabled, HELPER_IsDisabled.getFromRS(dummyIsDisabled, r, "is_disabled"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_User, r.getObject ("user_id"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_Company, r.getObject ("company_id"));
......@@ -678,10 +683,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}oneit_sec_user_extension " +
" (forgot_password_mail_send_date, forgot_password_key, role_type, roles, phone, verification_mail_send_date, verification_key, is_account_verified, is_email_changed, user_id, company_id, default_hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " +
" (forgot_password_mail_send_date, forgot_password_key, role_type, roles, phone, verification_mail_send_date, verification_key, is_account_verified, is_email_changed, is_disabled, user_id, company_id, default_hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", ?)",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))) .listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))) .listEntry (objectID.longID ()).listEntry (context.getTag (obj)).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", ?)",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))).listEntry (HELPER_IsDisabled.getForSQL(dummyIsDisabled, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsDisabled))) .listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))) .listEntry (objectID.longID ()).listEntry (context.getTag (obj)).toList().toArray());
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -58,6 +58,7 @@
<FORM name="*.updateCard" factory="Participant" class="performa.form.UpdateCardFP"/>
<FORM name="*.replaceCard" factory="Participant" class="performa.form.ReplaceCardFP"/>
<FORM name="*.addHiringTeam" factory="Participant" class="performa.form.AddHiringTeamFP"/>
<FORM name="*.saveCompanyUser" factory="Participant" class="performa.form.SaveCompanyUserFP"/>
</NODE>
<NODE name="job_assessment_criteria_add_jsp" factory="Participant">
......
......@@ -17,20 +17,23 @@
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
Collection companyUsers = (Collection<CompanyUser>) process.getAttribute("CompanyUsers");
Collection pendingUsers = (Collection<CompanyUser>) process.getAttribute("PendingUsers");
Collection disabledUsers = (Collection<CompanyUser>) process.getAttribute("DisabledUsers");
if(company==null)
if(company == null)
{
company = comUser.getCompany();
process.setAttribute("Company", company);
}
if(companyUsers == null || pendingUsers == null)
if(companyUsers == null || pendingUsers == null || disabledUsers == null)
{
companyUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new EqualsFilter<>(Boolean.TRUE)));
companyUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new EqualsFilter<>(Boolean.TRUE)).andIsDisabled(new EqualsFilter<>(Boolean.FALSE)));
pendingUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new NotEqualsFilter<>(Boolean.TRUE)));
disabledUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new EqualsFilter<>(Boolean.TRUE)).andIsDisabled(new EqualsFilter<>(Boolean.TRUE)));
process.setAttribute("CompanyUsers", companyUsers);
process.setAttribute("PendingUsers", pendingUsers);
process.setAttribute("DisabledUsers", disabledUsers);
}
if( request.getParameter("UserSortOption") != null)
......@@ -47,6 +50,7 @@
Collection<CompanyUser> sortedCompanyUsers = Utils.getUsersSorted(companyUsers, userSortOpt);
Collection<CompanyUser> sortedPendingUsers = Utils.getUsersSorted(pendingUsers, userSortOpt);
Collection<CompanyUser> sortedDisabledUsers = Utils.getUsersSorted(disabledUsers, userSortOpt);
company.setRoleType(RoleType.STANDARD);
%>
......@@ -147,13 +151,19 @@
</div>
</div>
</div>
<div class="m-user-right-padlock">
<div class="arrow_box disble" >DISABLE</div>
<div class="arrow_box enable" >ENABLE</div>
<span class="m-user-right-padlockicon">
<span class="padlock"></span>
</span>
</div>
<oneit:recalcClass htmlTag="div" classScript="companyUser.isOwner() ? 'hide': 'show'" companyUser="<%= companyUser %>">
<div class="m-user-right-padlock">
<div class="arrow_box disble" >DISABLE</div>
<div class="arrow_box enable" >ENABLE</div>
<oneit:button value=" " name="saveCompanyUser" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry("disabled", Boolean.TRUE)
.mapEntry("CompanyUser", companyUser)
.toMap() %>">
<span class="m-user-right-padlockicon"><span class="padlock"></span></span>
</oneit:button>
</div>
</oneit:recalcClass>
<div class="m-user-right">
<oneit:ormEnum obj="<%= companyUser %>" attributeName="Role" cssClass="form-control user-role" enums="<%= Arrays.asList(new RoleType[]{RoleType.ADMIN, RoleType.STANDARD}) %>"/>
</div>
......@@ -212,6 +222,45 @@
</div>
<%
}
for(CompanyUser companyUser : sortedDisabledUsers)
{
SecUser user = companyUser.getUser();
%>
<div class="user-list-row disabled" id="<%= companyUser.getID() %>">
<div class="m-user-left">
<div class="remove-icon">_</div>
<div class="m-user-icon"><img src="images/user-list-icon.png"></div>
<div class="m-user-info">
<div class="m-user-name">
<oneit:toString value="<%= SecUserToNameTransform.INSTANCE.transform(user) %>" mode="EscapeHTML" />
</div>
<div class="m-user-email">
<oneit:toString value="<%= user.getEmail() %>" mode="EscapeHTML" />
</div>
</div>
</div>
<div class="m-user-right-padlock">
<div class="arrow_box disble" >DISABLE</div>
<div class="arrow_box enable" >ENABLE</div>
<oneit:button value=" " name="saveCompanyUser" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry("disabled", Boolean.FALSE)
.mapEntry("CompanyUser", companyUser)
.toMap() %>">
<span class="m-user-right-padlockicon"><span class="padlock"></span></span>
</oneit:button>
</div>
<div class="m-user-right">
<oneit:ormEnum obj="<%= companyUser %>" attributeName="Role" cssClass="form-control user-role" enums="<%= Arrays.asList(new RoleType[]{RoleType.ADMIN, RoleType.STANDARD}) %>"/>
</div>
<oneit:button name="save" value="Save" cssClass="<%= "save-user" + companyUser.getID().toString() + " hidden"%>"
requestAttribs="<%= CollectionUtils.mapEntry("CompanyUser", companyUser).mapEntry("nextPage", usersPage + "&UserSortOption=" + userSortOpt).toMap() %>" />
</div>
<%
}
%>
</div>
</div>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">oneit_sec_user_extension</tableName>
<column name="is_disabled" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
update oneit_sec_user_extension set is_disabled= 'N';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment