Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
2af2566f
Commit
2af2566f
authored
Sep 11, 2017
by
chenith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to send invitations to new users.
parent
1a5b49e1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
185 additions
and
18 deletions
+185
-18
SendUserInvitationFP.java
cmsWebApp/src/performa/form/SendUserInvitationFP.java
+143
-0
VerifyCompanyUserFP.java
cmsWebApp/src/performa/form/VerifyCompanyUserFP.java
+1
-1
BaseCompany.java
cmsWebApp/src/performa/orm/BaseCompany.java
+0
-0
Company.xml
cmsWebApp/src/performa/orm/Company.xml
+5
-0
Utils.java
cmsWebApp/src/performa/utils/Utils.java
+2
-2
CustomServlets_adminPortal.xml
...oot/extensions/adminportal/CustomServlets_adminPortal.xml
+4
-0
company_user_data.jsp
.../webroot/extensions/adminportal/inc/company_user_data.jsp
+1
-1
manage_users.jsp
cmsWebApp/webroot/extensions/adminportal/manage_users.jsp
+23
-13
fieldnamesOverride.txt
...ot/extensions/adminportal/messages/fieldnamesOverride.txt
+5
-1
messagesOverride.txt
...root/extensions/adminportal/messages/messagesOverride.txt
+1
-0
No files found.
cmsWebApp/src/performa/form/SendUserInvitationFP.java
0 → 100644
View file @
2af2566f
package
performa
.
form
;
import
java.util.Date
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
oneit.business.content.Article
;
import
oneit.components.ParticipantInitialisationContext
;
import
oneit.email.ConfigurableArticleTemplateEmailer
;
import
oneit.email.ConfigurableEmailerException
;
import
oneit.logging.*
;
import
oneit.net.LoopbackHTTP
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.security.SecUser
;
import
oneit.servlets.forms.*
;
import
oneit.servlets.process.*
;
import
oneit.servlets.utils.NotificationUtils
;
import
oneit.utils.*
;
import
performa.orm.*
;
import
performa.utils.Utils
;
import
performa.utils.WebUtils
;
public
class
SendUserInvitationFP
extends
SaveFP
{
private
static
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"SendUserInvitationFP"
);
private
static
final
String
DEFAULT_PASSWORD
=
"Talentology123"
;
protected
ConfigurableArticleTemplateEmailer
invitationEmailer
;
@Override
public
void
validate
(
ORMProcessState
process
,
SubmissionDetails
submission
,
MultiException
exceptions
,
Map
params
)
throws
StorageException
{
HttpServletRequest
request
=
submission
.
getRequest
();
Company
company
=
(
Company
)
process
.
getAttribute
(
"Company"
);
BusinessObjectParser
.
assertFieldCondition
(
company
.
getUserEmail
()!=
null
,
company
,
Company
.
FIELD_UserEmail
,
"mandatory"
,
exceptions
,
true
,
request
);
BusinessObjectParser
.
assertFieldCondition
(!
isEmailFound
(
process
.
getTransaction
(),
company
.
getUserEmail
()),
company
,
Company
.
FIELD_UserEmail
,
"emailExists"
,
exceptions
,
true
,
request
);
BusinessObjectParser
.
assertFieldCondition
(
company
.
getRoleType
()!=
null
,
company
,
Company
.
FIELD_RoleType
,
"mandatory"
,
exceptions
,
true
,
request
);
super
.
validate
(
process
,
submission
,
exceptions
,
params
);
}
@Override
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
{
HttpServletRequest
request
=
submission
.
getRequest
();
ObjectTransaction
objTran
=
process
.
getTransaction
();
Company
company
=
(
Company
)
process
.
getAttribute
(
"Company"
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Started to create new use"
,
company
);
SecUser
newUser
=
SecUser
.
createSecUser
(
objTran
);
CompanyUser
newComUser
=
newUser
.
getExtensionOrCreate
(
CompanyUser
.
REFERENCE_CompanyUser
);
newUser
.
setUserName
(
company
.
getUserEmail
().
toLowerCase
());
newUser
.
setEmail
(
newUser
.
getUserName
());
newUser
.
setAttribute
(
"md5:"
+
SecUser
.
FIELD_Password
,
DEFAULT_PASSWORD
);
newUser
.
addRole
(
Utils
.
getRole
(
Utils
.
ROLE_CLIENT
,
objTran
));
newUser
.
setFirstName
(
company
.
getFirstName
());
newUser
.
setLastName
(
company
.
getLastName
());
newComUser
.
setCompany
(
company
);
newComUser
.
setRole
(
company
.
getRoleType
());
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"New user created :: "
,
newUser
);
sendInvitationMail
(
newComUser
,
request
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"End of sending invitation email."
,
newUser
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
@Override
public
void
init
(
ParticipantInitialisationContext
context
)
throws
InitialisationException
{
super
.
init
(
context
);
invitationEmailer
=
(
ConfigurableArticleTemplateEmailer
)
(
context
.
getSingleChild
(
"InvitationEmailer"
));
}
protected
void
sendInvitationMail
(
CompanyUser
companyUser
,
HttpServletRequest
request
)
throws
BusinessException
{
if
(
companyUser
.
getIsAccountVerified
()!=
Boolean
.
TRUE
)
{
try
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Sending invitation mail from SendUserInvitationFP to :: "
,
companyUser
);
Article
invitationArticle
=
WebUtils
.
getArticleByShortCut
(
companyUser
.
getTransaction
(),
WebUtils
.
COMPANY_ACCOUNT_VERIFICATION
);
RandomStringGen
random
=
new
RandomStringGen
();
//set invitation key and send mail time
companyUser
.
setVerificationKey
(
random
.
generateAlphaNum
(
6
));
companyUser
.
setVerificationMailSendDate
(
new
Date
());
String
link
=
LoopbackHTTP
.
getRemoteAccessURL
(
request
)
+
invitationArticle
.
getLink
(
request
,
CollectionUtils
.
EMPTY_MAP
,
"/"
)
+
"?id="
+
companyUser
.
getID
()
+
"&key="
+
companyUser
.
getVerificationKey
();
Map
defaultParams
=
CollectionUtils
.
mapEntry
(
"link"
,
link
).
toMap
();
ObjectTransform
transform
=
Utils
.
createCompoundTransform
(
defaultParams
,
companyUser
);
Utils
.
sendMail
(
invitationEmailer
,
transform
,
new
String
[]{
companyUser
.
getUser
().
getUserName
()},
null
,
companyUser
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Sent invitation mail successfully from "
+
SendUserInvitationFP
.
class
+
" to :: "
,
companyUser
);
}
catch
(
ConfigurableEmailerException
ex
)
{
LogMgr
.
log
(
LOG
,
LogLevel
.
SYSTEMERROR1
,
ex
,
"Error occured while sending mail for Candidate :: "
+
companyUser
);
throw
new
BusinessException
(
"We are unable to send mail. Please try again or contact Talentology for more details."
);
}
}
else
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Call from "
+
SendUserInvitationFP
.
class
+
". Account is already verified for candidate :: "
,
companyUser
);
}
}
private
Boolean
isEmailFound
(
ObjectTransaction
objTran
,
String
email
)
{
if
(
email
!=
null
)
{
SecUser
user
=
SecUser
.
searchNAME
(
objTran
,
email
.
toLowerCase
());
if
(
user
!=
null
)
//&& user.getExtension(CompanyUser.REFERENCE_CompanyUser)!=null
{
return
Boolean
.
TRUE
;
}
}
return
Boolean
.
FALSE
;
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/VerifyCompanyUserFP.java
View file @
2af2566f
...
@@ -62,7 +62,7 @@ public class VerifyCompanyUserFP extends ORMProcessFormProcessor
...
@@ -62,7 +62,7 @@ public class VerifyCompanyUserFP extends ORMProcessFormProcessor
if
(
CollectionUtils
.
equals
(
companyUser
.
getPassword
(),
companyUser
.
getConfirmPassword
()))
if
(
CollectionUtils
.
equals
(
companyUser
.
getPassword
(),
companyUser
.
getConfirmPassword
()))
{
{
if
(
company
.
getIsVerified
()!=
Boolean
.
TRUE
)
if
(
company
.
getIsVerified
()!=
Boolean
.
TRUE
&&
CollectionUtils
.
equals
(
company
.
getAddedByUser
(),
companyUser
)
)
{
{
process
.
setAttribute
(
"Company"
,
company
);
process
.
setAttribute
(
"Company"
,
company
);
...
...
cmsWebApp/src/performa/orm/BaseCompany.java
View file @
2af2566f
This diff is collapsed.
Click to expand it.
cmsWebApp/src/performa/orm/Company.xml
View file @
2af2566f
...
@@ -11,6 +11,11 @@
...
@@ -11,6 +11,11 @@
<MULTIPLEREFERENCE
name=
"Users"
type=
"CompanyUser"
backreferenceName=
"Company"
/>
<MULTIPLEREFERENCE
name=
"Users"
type=
"CompanyUser"
backreferenceName=
"Company"
/>
<MULTIPLEREFERENCE
name=
"Clients"
type=
"Client"
backreferenceName=
"Company"
/>
<MULTIPLEREFERENCE
name=
"Clients"
type=
"Client"
backreferenceName=
"Company"
/>
<TRANSIENT
name=
"UserEmail"
type=
"String"
validators=
"Email"
/>
<TRANSIENT
name=
"FirstName"
type=
"String"
/>
<TRANSIENT
name=
"LastName"
type=
"String"
/>
<TRANSIENT
name=
"RoleType"
type=
"RoleType"
defaultValue=
"RoleType.STANDARD"
attribHelper=
"EnumeratedAttributeHelper"
/>
<TABLE
name=
"tl_company"
tablePrefix=
"object"
>
<TABLE
name=
"tl_company"
tablePrefix=
"object"
>
<ATTRIB
name=
"CompanyName"
type=
"String"
dbcol=
"company_name"
mandatory=
"true"
length=
"100"
/>
<ATTRIB
name=
"CompanyName"
type=
"String"
dbcol=
"company_name"
mandatory=
"true"
length=
"100"
/>
...
...
cmsWebApp/src/performa/utils/Utils.java
View file @
2af2566f
...
@@ -185,7 +185,7 @@ public class Utils
...
@@ -185,7 +185,7 @@ public class Utils
}
}
public
static
List
<
CompanyUser
>
getUsersSorted
(
CompanyUser
[]
users
,
UserSortOption
userSortOption
)
public
static
List
<
CompanyUser
>
getUsersSorted
(
Set
<
CompanyUser
>
users
,
UserSortOption
userSortOption
)
{
{
ObjectTransform
transform
=
Client
.
pipesClient
().
toObjectCreated
();
ObjectTransform
transform
=
Client
.
pipesClient
().
toObjectCreated
();
Comparator
comparator
=
CollectionUtils
.
DEFAULT_COMPARATOR
;
Comparator
comparator
=
CollectionUtils
.
DEFAULT_COMPARATOR
;
...
@@ -201,7 +201,7 @@ public class Utils
...
@@ -201,7 +201,7 @@ public class Utils
comparator
=
CollectionUtils
.
reverse
(
CollectionUtils
.
CASE_INSENSITIVE_COMPARATOR
);
comparator
=
CollectionUtils
.
reverse
(
CollectionUtils
.
CASE_INSENSITIVE_COMPARATOR
);
}
}
return
ObjstoreUtils
.
sort
(
Arrays
.
asList
(
users
)
,
return
ObjstoreUtils
.
sort
(
users
,
new
ObjectTransform
[]{
transform
},
new
ObjectTransform
[]{
transform
},
new
Comparator
[]{
comparator
});
new
Comparator
[]{
comparator
});
}
}
...
...
cmsWebApp/webroot/extensions/adminportal/CustomServlets_adminPortal.xml
View file @
2af2566f
...
@@ -38,6 +38,10 @@
...
@@ -38,6 +38,10 @@
<AccountCreatedEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"AccountCreatedMail"
/>
<AccountCreatedEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"AccountCreatedMail"
/>
<InvitationEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"InvitationMail"
/>
<InvitationEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"InvitationMail"
/>
</FORM>
</FORM>
<FORM
name=
"*.sendUserInvites"
factory=
"Participant"
class=
"performa.form.SendUserInvitationFP"
>
<AccountCreatedEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"AccountCreatedMail"
/>
<InvitationEmailer
factory=
"Participant"
class=
"oneit.email.ConfigurableArticleTemplateEmailer"
templateShortcut=
"InvitationMail"
/>
</FORM>
<FORM
name=
"*.saveUserDetails"
factory=
"Participant"
class=
"performa.form.SaveUserDetailsFP"
/>
<FORM
name=
"*.saveUserDetails"
factory=
"Participant"
class=
"performa.form.SaveUserDetailsFP"
/>
</NODE>
</NODE>
...
...
cmsWebApp/webroot/extensions/adminportal/inc/company_user_data.jsp
View file @
2af2566f
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<div class="form-group text-left">
<div class="form-group text-left">
<label>Company</label>
<label>Company</label>
<%
<%
if(company.getIsVerified()==Boolean.TRUE)
if(company.getIsVerified()==Boolean.TRUE
|| !CollectionUtils.equals(company.getAddedByUser(), companyUser)
)
{
{
%>
%>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" readonly="true" required="true"/>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" readonly="true" required="true"/>
...
...
cmsWebApp/webroot/extensions/adminportal/manage_users.jsp
View file @
2af2566f
...
@@ -6,10 +6,21 @@
...
@@ -6,10 +6,21 @@
<oneit:dynIncluded>
<oneit:dynIncluded>
<%
<%
// String nextPage = WebUtils.getSamePageInRenderMode(request, WebUtils.EDIT_CLIENT
);
String currentPage = WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.MANAGE_USERS).getLink(request
);
String usersPage = WebUtils.getSamePageInRenderMode(request, "Page");
String usersPage = WebUtils.getSamePageInRenderMode(request, "Page");
ObjectTransaction objTran = process.getTransaction ();
SecUser secUser = SecUser.getTXUser(objTran);
Company company = (Company) process.getAttribute("Company");
CompanyUser comUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
if(company==null)
{
company = comUser.getCompany();
process.setAttribute("Company", company);
}
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
CompanyUser[] companyUsers = (CompanyUser[]
) process.getAttribute("CompanyUsers");
Set<CompanyUser> companyUsers = (Set<CompanyUser>
) process.getAttribute("CompanyUsers");
if( request.getParameter("UserSortOption") != null)
if( request.getParameter("UserSortOption") != null)
{
{
...
@@ -23,9 +34,7 @@
...
@@ -23,9 +34,7 @@
if(companyUsers == null)
if(companyUsers == null)
{
{
companyUsers = CompanyUser.SearchByAllCompanyUsers()
companyUsers = company.getUsersSet();
.byReferenceExtension(CompanyUser.REFERENCE_CompanyUser)
.search(transaction);
process.setAttribute("CompanyUsers", companyUsers);
process.setAttribute("CompanyUsers", companyUsers);
}
}
...
@@ -136,25 +145,26 @@
...
@@ -136,25 +145,26 @@
</div>
</div>
<div class="form-group">
<div class="form-group">
<label><oneit:label GUIName="Email Address" /></label>
<label><oneit:label GUIName="Email Address" /></label>
<
input type="text" name="" class="form-control" />
<
oneit:ormInput obj="<%= company %>" type="text" attributeName="UserEmail" cssClass="form-control" style="text-transform: lowercase"/>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label><oneit:label GUIName="First Name" /></label>
<label><oneit:label GUIName="First Name" /></label>
<
input type="text" name="" class="form-control"
/>
<
oneit:ormInput obj="<%= company %>" type="text" attributeName="FirstName" cssClass="form-control"
/>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label><oneit:label GUIName="Last Name" /></label>
<label><oneit:label GUIName="Last Name" /></label>
<
input type="text" name="" class="form-control"
/>
<
oneit:ormInput obj="<%= company %>" type="text" attributeName="FirstName" cssClass="form-control"
/>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label><oneit:label GUIName="Role" /></label>
<label><oneit:label GUIName="Role" /></label>
<select class="form-control">
<oneit:ormEnum obj="<%= company %>" attributeName="RoleType" cssClass="form-control"/>
<option>Admin</option>
<option>Standard</option>
</select>
</div>
</div>
<div class="invite-btn">
<div class="invite-btn">
<input type="button" name="" class="btn btn-invite" value="Invite" />
<oneit:button value="Invite" name="sendUserInvites" cssClass="btn btn-invite"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "invitationSent")
.toMap() %>" />
</div>
</div>
</div>
</div>
</div>
</div>
...
...
cmsWebApp/webroot/extensions/adminportal/messages/fieldnamesOverride.txt
View file @
2af2566f
...
@@ -25,5 +25,9 @@ Client.ContactSurname = Contact Last Name
...
@@ -25,5 +25,9 @@ Client.ContactSurname = Contact Last Name
Client.ClientLogo = Client Logo
Client.ClientLogo = Client Logo
Client.State = State or Province
Client.State = State or Province
Company.TimeZone =
Company.TimeZone =
Time zone
Company.HasClientSupport = We help clients with hiring
Company.HasClientSupport = We help clients with hiring
Company.UserEmail = Email Address
Company.FirstName = First Name
Company.LastName = Last Name
Company.RoleType = Role
cmsWebApp/webroot/extensions/adminportal/messages/messagesOverride.txt
View file @
2af2566f
...
@@ -3,3 +3,4 @@
...
@@ -3,3 +3,4 @@
#saveTemplateFirst = Please save template first, before proceeding to the next step
#saveTemplateFirst = Please save template first, before proceeding to the next step
#passwordNotMatch = The password does not match. Please try again.
#passwordNotMatch = The password does not match. Please try again.
#resetPasswordEmailSent = A password rest email has been sent to you. Please check your email.
#resetPasswordEmailSent = A password rest email has been sent to you. Please check your email.
#invitationSent = Your invitation has been successfully sent.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment