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
......@@ -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"/>
......
......@@ -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>
<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>
<span class="m-user-right-padlockicon">
<span class="padlock"></span>
</span>
<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