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
bee8281b
Commit
bee8281b
authored
Jan 25, 2018
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding role type Billing and Owner
parent
b7918eda
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
295 additions
and
18 deletions
+295
-18
CompanyUser.xml
cmsWebApp/sql/CompanyUser.xml
+1
-0
CompanyUser.sql
cmsWebApp/sql/ms/CompanyUser.sql
+1
-0
CompanyUser.sql
cmsWebApp/sql/oracle/CompanyUser.sql
+1
-0
CompanyUser.sql
cmsWebApp/sql/postgres/CompanyUser.sql
+1
-0
SendCompanyUserInvitesFP.java
cmsWebApp/src/performa/form/SendCompanyUserInvitesFP.java
+3
-0
BaseCompanyUser.java
cmsWebApp/src/performa/orm/BaseCompanyUser.java
+212
-0
CompanyUser.java
cmsWebApp/src/performa/orm/CompanyUser.java
+32
-0
CompanyUser.xml
cmsWebApp/src/performa/orm/CompanyUser.xml
+11
-10
CompanyUserPersistenceMgr.java
cmsWebApp/src/performa/orm/CompanyUserPersistenceMgr.java
+11
-6
RoleType.java
cmsWebApp/src/performa/orm/types/RoleType.java
+5
-1
RoleType.xml
cmsWebApp/src/performa/orm/types/RoleType.xml
+2
-0
manage_users.jsp
cmsWebApp/webroot/extensions/adminportal/manage_users.jsp
+1
-1
20180124_Alter_CompanyUser.xml
...tensions/performa/upgrades/20180124_Alter_CompanyUser.xml
+14
-0
No files found.
cmsWebApp/sql/CompanyUser.xml
View file @
bee8281b
...
...
@@ -12,6 +12,7 @@
<column
name=
"forgot_password_mail_send_date"
type=
"Date"
nullable=
"true"
/>
<column
name=
"forgot_password_key"
type=
"String"
nullable=
"true"
length=
"10"
/>
<column
name=
"role_type"
type=
"String"
nullable=
"true"
length=
"200"
/>
<column
name=
"roles"
type=
"String"
nullable=
"true"
length=
"200"
/>
<column
name=
"phone"
type=
"String"
nullable=
"true"
length=
"30"
/>
<column
name=
"verification_mail_send_date"
type=
"Date"
nullable=
"true"
/>
<column
name=
"verification_key"
type=
"String"
nullable=
"true"
length=
"10"
/>
...
...
cmsWebApp/sql/ms/CompanyUser.sql
View file @
bee8281b
...
...
@@ -11,6 +11,7 @@ CREATE TABLE oneit_sec_user_extension (
forgot_password_mail_send_date
datetime
NULL
,
forgot_password_key
varchar
(
10
)
NULL
,
role_type
varchar
(
200
)
NULL
,
roles
varchar
(
200
)
NULL
,
phone
varchar
(
30
)
NULL
,
verification_mail_send_date
datetime
NULL
,
verification_key
varchar
(
10
)
NULL
,
...
...
cmsWebApp/sql/oracle/CompanyUser.sql
View file @
bee8281b
...
...
@@ -12,6 +12,7 @@ CREATE TABLE oneit_sec_user_extension (
forgot_password_mail_send_date
date
NULL
,
forgot_password_key
varchar2
(
10
)
NULL
,
role_type
varchar2
(
200
)
NULL
,
roles
varchar2
(
200
)
NULL
,
phone
varchar2
(
30
)
NULL
,
verification_mail_send_date
date
NULL
,
verification_key
varchar2
(
10
)
NULL
,
...
...
cmsWebApp/sql/postgres/CompanyUser.sql
View file @
bee8281b
...
...
@@ -12,6 +12,7 @@ CREATE TABLE oneit_sec_user_extension (
forgot_password_mail_send_date
timestamp
NULL
,
forgot_password_key
varchar
(
10
)
NULL
,
role_type
varchar
(
200
)
NULL
,
roles
varchar
(
200
)
NULL
,
phone
varchar
(
30
)
NULL
,
verification_mail_send_date
timestamp
NULL
,
verification_key
varchar
(
10
)
NULL
,
...
...
cmsWebApp/src/performa/form/SendCompanyUserInvitesFP.java
View file @
bee8281b
...
...
@@ -9,7 +9,9 @@ import com.stripe.exception.InvalidRequestException;
import
com.stripe.model.Customer
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.business.content.Article
;
...
...
@@ -110,6 +112,7 @@ public class SendCompanyUserInvitesFP extends SaveFP
{
companyUser
.
setRole
(
RoleType
.
ADMIN
);
companyUser
.
setRoleTypes
(
RoleType
.
OWNER
,
RoleType
.
BILLING
);
// Create customer in Stripe and subscribe for plan 0001 and coupon EAP. Only for 0.0.4.1 release
// Need to handle properly when plan and billing screens are added
...
...
cmsWebApp/src/performa/orm/BaseCompanyUser.java
View file @
bee8281b
...
...
@@ -45,6 +45,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
public
static
final
String
FIELD_ForgotPasswordMailSendDate
=
"ForgotPasswordMailSendDate"
;
public
static
final
String
FIELD_ForgotPasswordKey
=
"ForgotPasswordKey"
;
public
static
final
String
FIELD_Role
=
"Role"
;
public
static
final
String
FIELD_Roles
=
"Roles"
;
public
static
final
String
FIELD_Phone
=
"Phone"
;
public
static
final
String
FIELD_VerificationMailSendDate
=
"VerificationMailSendDate"
;
public
static
final
String
FIELD_VerificationKey
=
"VerificationKey"
;
...
...
@@ -68,6 +69,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_ForgotPasswordMailSendDate
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_ForgotPasswordKey
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
EnumeratedAttributeHelper
<
CompanyUser
,
RoleType
>
HELPER_Role
=
new
EnumeratedAttributeHelper
<
CompanyUser
,
RoleType
>
(
RoleType
.
FACTORY_RoleType
);
private
static
final
DelimitedEnumsAttributeHelper
HELPER_Roles
=
new
DelimitedEnumsAttributeHelper
(
RoleType
.
FACTORY_RoleType
);
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_Phone
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_VerificationMailSendDate
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_VerificationKey
=
DefaultAttributeHelper
.
INSTANCE
;
...
...
@@ -84,6 +86,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
Date
_ForgotPasswordMailSendDate
;
private
String
_ForgotPasswordKey
;
private
RoleType
_Role
;
private
Set
<
RoleType
>
_Roles
;
private
String
_Phone
;
private
Date
_VerificationMailSendDate
;
private
String
_VerificationKey
;
...
...
@@ -113,6 +116,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
static
final
AttributeValidator
[]
FIELD_ForgotPasswordMailSendDate_Validators
;
private
static
final
AttributeValidator
[]
FIELD_ForgotPasswordKey_Validators
;
private
static
final
AttributeValidator
[]
FIELD_Role_Validators
;
private
static
final
AttributeValidator
[]
FIELD_Roles_Validators
;
private
static
final
AttributeValidator
[]
FIELD_Phone_Validators
;
private
static
final
AttributeValidator
[]
FIELD_VerificationMailSendDate_Validators
;
private
static
final
AttributeValidator
[]
FIELD_VerificationKey_Validators
;
...
...
@@ -141,6 +145,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
FIELD_ForgotPasswordMailSendDate_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_ForgotPasswordMailSendDate
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_ForgotPasswordKey_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_ForgotPasswordKey
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_Role_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_Role
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_Roles_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_Roles
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_Phone_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_Phone
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_VerificationMailSendDate_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_VerificationMailSendDate
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_VerificationKey_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_VerificationKey
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
...
...
@@ -287,6 +292,27 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
// Meta Info setup
private
static
List
setupAttribMetaData_Roles
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
metaInfo
.
put
(
"attribHelper"
,
"DelimitedEnumsAttributeHelper"
);
metaInfo
.
put
(
"attribHelperInstance"
,
"new DelimitedEnumsAttributeHelper (RoleType.FACTORY_RoleType)"
);
metaInfo
.
put
(
"dbcol"
,
"roles"
);
metaInfo
.
put
(
"mandatory"
,
"false"
);
metaInfo
.
put
(
"name"
,
"Roles"
);
metaInfo
.
put
(
"type"
,
"Set<RoleType>"
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG2
,
"Metadata for CompanyUser.Roles:"
,
metaInfo
);
ATTRIBUTES_METADATA_CompanyUser
.
put
(
FIELD_Roles
,
Collections
.
unmodifiableMap
(
metaInfo
));
List
validators
=
BaseBusinessClass
.
getAttribValidators
(
CompanyUser
.
class
,
"Roles"
,
metaInfo
,
validatorMapping
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG1
,
"Validators for CompanyUser.Roles:"
,
validators
);
return
validators
;
}
// Meta Info setup
private
static
List
setupAttribMetaData_Phone
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
...
...
@@ -449,6 +475,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_ForgotPasswordMailSendDate
=
(
Date
)(
HELPER_ForgotPasswordMailSendDate
.
initialise
(
_ForgotPasswordMailSendDate
));
_ForgotPasswordKey
=
(
String
)(
HELPER_ForgotPasswordKey
.
initialise
(
_ForgotPasswordKey
));
_Role
=
(
RoleType
)(
HELPER_Role
.
initialise
(
_Role
));
_Roles
=
(
Set
<
RoleType
>)(
HELPER_Roles
.
initialise
(
_Roles
));
_Phone
=
(
String
)(
HELPER_Phone
.
initialise
(
_Phone
));
_VerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
initialise
(
_VerificationMailSendDate
));
_VerificationKey
=
(
String
)(
HELPER_VerificationKey
.
initialise
(
_VerificationKey
));
...
...
@@ -780,6 +807,104 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute Roles
*/
public
Set
<
RoleType
>
getRoles
()
{
assertValid
();
Set
<
RoleType
>
valToReturn
=
_Roles
;
for
(
CompanyUserBehaviourDecorator
bhd
:
CompanyUser_BehaviourDecorators
)
{
valToReturn
=
bhd
.
getRoles
((
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
preRolesChange
(
Set
<
RoleType
>
newRoles
)
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
postRolesChange
()
throws
FieldException
{
}
public
FieldWriteability
getWriteability_Roles
()
{
return
getFieldWritabilityUtil
(
FieldWriteability
.
TRUE
);
}
/**
* Set the attribute Roles. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public
void
setRoles
(
Set
<
RoleType
>
newRoles
)
throws
FieldException
{
boolean
oldAndNewIdentical
=
HELPER_Roles
.
compare
(
_Roles
,
newRoles
);
try
{
for
(
CompanyUserBehaviourDecorator
bhd
:
CompanyUser_BehaviourDecorators
)
{
newRoles
=
bhd
.
setRoles
((
CompanyUser
)
this
,
newRoles
);
oldAndNewIdentical
=
HELPER_Roles
.
compare
(
_Roles
,
newRoles
);
}
if
(
FIELD_Roles_Validators
.
length
>
0
)
{
Object
newRolesObj
=
HELPER_Roles
.
toObject
(
newRoles
);
if
(
newRolesObj
!=
null
)
{
int
loopMax
=
FIELD_Roles_Validators
.
length
;
Map
metadata
=
(
Map
)
ATTRIBUTES_METADATA_CompanyUser
.
get
(
FIELD_Roles
);
for
(
int
v
=
0
;
v
<
loopMax
;
++
v
)
{
FIELD_Roles_Validators
[
v
].
checkAttribute
(
this
,
FIELD_Roles
,
metadata
,
newRolesObj
);
}
}
}
}
catch
(
FieldException
e
)
{
if
(!
oldAndNewIdentical
)
{
e
.
setWouldModify
();
}
throw
e
;
}
if
(!
oldAndNewIdentical
)
{
assertValid
();
Debug
.
assertion
(
getWriteability_Roles
()
!=
FieldWriteability
.
FALSE
,
"Field Roles is not writeable"
);
preRolesChange
(
newRoles
);
markFieldChange
(
FIELD_Roles
);
_Roles
=
newRoles
;
postFieldChange
(
FIELD_Roles
);
postRolesChange
();
}
}
/**
* Get the attribute Phone
*/
public
String
getPhone
()
...
...
@@ -2161,6 +2286,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_ForgotPasswordMailSendDate
,
HELPER_ForgotPasswordMailSendDate
.
toObject
(
_ForgotPasswordMailSendDate
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_ForgotPasswordKey
,
HELPER_ForgotPasswordKey
.
toObject
(
_ForgotPasswordKey
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_Role
,
HELPER_Role
.
toObject
(
_Role
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_Roles
,
HELPER_Roles
.
toObject
(
_Roles
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_Phone
,
HELPER_Phone
.
toObject
(
_Phone
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_VerificationMailSendDate
,
HELPER_VerificationMailSendDate
.
toObject
(
_VerificationMailSendDate
));
//
oneit_sec_user_extensionPSet
.
setAttrib
(
FIELD_VerificationKey
,
HELPER_VerificationKey
.
toObject
(
_VerificationKey
));
//
...
...
@@ -2186,6 +2312,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_ForgotPasswordMailSendDate
=
(
Date
)(
HELPER_ForgotPasswordMailSendDate
.
fromObject
(
_ForgotPasswordMailSendDate
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_ForgotPasswordMailSendDate
)));
//
_ForgotPasswordKey
=
(
String
)(
HELPER_ForgotPasswordKey
.
fromObject
(
_ForgotPasswordKey
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_ForgotPasswordKey
)));
//
_Role
=
(
RoleType
)(
HELPER_Role
.
fromObject
(
_Role
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_Role
)));
//
_Roles
=
(
Set
<
RoleType
>)(
HELPER_Roles
.
fromObject
(
_Roles
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_Roles
)));
//
_Phone
=
(
String
)(
HELPER_Phone
.
fromObject
(
_Phone
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_Phone
)));
//
_VerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
fromObject
(
_VerificationMailSendDate
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_VerificationMailSendDate
)));
//
_VerificationKey
=
(
String
)(
HELPER_VerificationKey
.
fromObject
(
_VerificationKey
,
oneit_sec_user_extensionPSet
.
getAttrib
(
FIELD_VerificationKey
)));
//
...
...
@@ -2238,6 +2365,15 @@ public abstract class BaseCompanyUser extends SecUserExtension
try
{
setRoles
(
otherCompanyUser
.
getRoles
());
}
catch
(
FieldException
ex
)
{
e
.
addException
(
ex
);
}
try
{
setPhone
(
otherCompanyUser
.
getPhone
());
}
catch
(
FieldException
ex
)
...
...
@@ -2317,6 +2453,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_ForgotPasswordMailSendDate
=
sourceCompanyUser
.
_ForgotPasswordMailSendDate
;
_ForgotPasswordKey
=
sourceCompanyUser
.
_ForgotPasswordKey
;
_Role
=
sourceCompanyUser
.
_Role
;
_Roles
=
sourceCompanyUser
.
_Roles
;
_Phone
=
sourceCompanyUser
.
_Phone
;
_VerificationMailSendDate
=
sourceCompanyUser
.
_VerificationMailSendDate
;
_VerificationKey
=
sourceCompanyUser
.
_VerificationKey
;
...
...
@@ -2383,6 +2520,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_ForgotPasswordMailSendDate
=
(
Date
)(
HELPER_ForgotPasswordMailSendDate
.
readExternal
(
_ForgotPasswordMailSendDate
,
vals
.
get
(
FIELD_ForgotPasswordMailSendDate
)));
//
_ForgotPasswordKey
=
(
String
)(
HELPER_ForgotPasswordKey
.
readExternal
(
_ForgotPasswordKey
,
vals
.
get
(
FIELD_ForgotPasswordKey
)));
//
_Role
=
(
RoleType
)(
HELPER_Role
.
readExternal
(
_Role
,
vals
.
get
(
FIELD_Role
)));
//
_Roles
=
(
Set
<
RoleType
>)(
HELPER_Roles
.
readExternal
(
_Roles
,
vals
.
get
(
FIELD_Roles
)));
//
_Phone
=
(
String
)(
HELPER_Phone
.
readExternal
(
_Phone
,
vals
.
get
(
FIELD_Phone
)));
//
_VerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
readExternal
(
_VerificationMailSendDate
,
vals
.
get
(
FIELD_VerificationMailSendDate
)));
//
_VerificationKey
=
(
String
)(
HELPER_VerificationKey
.
readExternal
(
_VerificationKey
,
vals
.
get
(
FIELD_VerificationKey
)));
//
...
...
@@ -2408,6 +2546,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
vals
.
put
(
FIELD_ForgotPasswordMailSendDate
,
HELPER_ForgotPasswordMailSendDate
.
writeExternal
(
_ForgotPasswordMailSendDate
));
vals
.
put
(
FIELD_ForgotPasswordKey
,
HELPER_ForgotPasswordKey
.
writeExternal
(
_ForgotPasswordKey
));
vals
.
put
(
FIELD_Role
,
HELPER_Role
.
writeExternal
(
_Role
));
vals
.
put
(
FIELD_Roles
,
HELPER_Roles
.
writeExternal
(
_Roles
));
vals
.
put
(
FIELD_Phone
,
HELPER_Phone
.
writeExternal
(
_Phone
));
vals
.
put
(
FIELD_VerificationMailSendDate
,
HELPER_VerificationMailSendDate
.
writeExternal
(
_VerificationMailSendDate
));
vals
.
put
(
FIELD_VerificationKey
,
HELPER_VerificationKey
.
writeExternal
(
_VerificationKey
));
...
...
@@ -2444,6 +2583,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_Role
,
HELPER_Role
.
toObject
(
this
.
_Role
),
HELPER_Role
.
toObject
(
otherCompanyUser
.
_Role
));
}
if
(!
HELPER_Roles
.
compare
(
this
.
_Roles
,
otherCompanyUser
.
_Roles
))
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_Roles
,
HELPER_Roles
.
toObject
(
this
.
_Roles
),
HELPER_Roles
.
toObject
(
otherCompanyUser
.
_Roles
));
}
if
(!
HELPER_Phone
.
compare
(
this
.
_Phone
,
otherCompanyUser
.
_Phone
))
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_Phone
,
HELPER_Phone
.
toObject
(
this
.
_Phone
),
HELPER_Phone
.
toObject
(
otherCompanyUser
.
_Phone
));
...
...
@@ -2501,6 +2644,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
visitor
.
visitField
(
this
,
FIELD_ForgotPasswordMailSendDate
,
HELPER_ForgotPasswordMailSendDate
.
toObject
(
getForgotPasswordMailSendDate
()));
visitor
.
visitField
(
this
,
FIELD_ForgotPasswordKey
,
HELPER_ForgotPasswordKey
.
toObject
(
getForgotPasswordKey
()));
visitor
.
visitField
(
this
,
FIELD_Role
,
HELPER_Role
.
toObject
(
getRole
()));
visitor
.
visitField
(
this
,
FIELD_Roles
,
HELPER_Roles
.
toObject
(
getRoles
()));
visitor
.
visitField
(
this
,
FIELD_Phone
,
HELPER_Phone
.
toObject
(
getPhone
()));
visitor
.
visitField
(
this
,
FIELD_VerificationMailSendDate
,
HELPER_VerificationMailSendDate
.
toObject
(
getVerificationMailSendDate
()));
visitor
.
visitField
(
this
,
FIELD_VerificationKey
,
HELPER_VerificationKey
.
toObject
(
getVerificationKey
()));
...
...
@@ -2558,6 +2702,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
filter
.
matches
(
getRole
());
}
else
if
(
attribName
.
equals
(
FIELD_Roles
))
{
return
filter
.
matches
(
getRoles
());
}
else
if
(
attribName
.
equals
(
FIELD_Phone
))
{
return
filter
.
matches
(
getPhone
());
...
...
@@ -2639,6 +2787,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return
this
;
}
public
SearchAll
andRoles
(
QueryFilter
<
Set
<
RoleType
>>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.roles"
,
"Roles"
);
return
this
;
}
public
SearchAll
andPhone
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.phone"
,
"Phone"
);
...
...
@@ -2768,6 +2922,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return
this
;
}
public
SearchAllCompanyUsers
andRoles
(
QueryFilter
<
Set
<
RoleType
>>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.roles"
,
"Roles"
);
return
this
;
}
public
SearchAllCompanyUsers
andPhone
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.phone"
,
"Phone"
);
...
...
@@ -2904,6 +3064,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return
this
;
}
public
SearchIdPin
andRoles
(
QueryFilter
<
Set
<
RoleType
>>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.roles"
,
"Roles"
);
return
this
;
}
public
SearchIdPin
andPhone
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"oneit_sec_user_extension.phone"
,
"Phone"
);
...
...
@@ -3005,6 +3171,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
HELPER_Role
.
toObject
(
getRole
());
}
else
if
(
attribName
.
equals
(
FIELD_Roles
))
{
return
HELPER_Roles
.
toObject
(
getRoles
());
}
else
if
(
attribName
.
equals
(
FIELD_Phone
))
{
return
HELPER_Phone
.
toObject
(
getPhone
());
...
...
@@ -3070,6 +3240,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
HELPER_Role
;
}
else
if
(
attribName
.
equals
(
FIELD_Roles
))
{
return
HELPER_Roles
;
}
else
if
(
attribName
.
equals
(
FIELD_Phone
))
{
return
HELPER_Phone
;
...
...
@@ -3135,6 +3309,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
setRole
((
RoleType
)(
HELPER_Role
.
fromObject
(
_Role
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_Roles
))
{
setRoles
((
Set
<
RoleType
>)(
HELPER_Roles
.
fromObject
(
_Roles
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_Phone
))
{
setPhone
((
String
)(
HELPER_Phone
.
fromObject
(
_Phone
,
attribValue
)));
...
...
@@ -3207,6 +3385,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
getWriteability_Role
();
}
else
if
(
fieldName
.
equals
(
FIELD_Roles
))
{
return
getWriteability_Roles
();
}
else
if
(
fieldName
.
equals
(
FIELD_Phone
))
{
return
getWriteability_Phone
();
...
...
@@ -3276,6 +3458,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
fields
.
add
(
FIELD_Role
);
}
if
(
getWriteability_Roles
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_Roles
);
}
if
(
getWriteability_Phone
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_Phone
);
...
...
@@ -3338,6 +3525,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
result
.
add
(
HELPER_ForgotPasswordMailSendDate
.
getAttribObject
(
getClass
(),
_ForgotPasswordMailSendDate
,
false
,
FIELD_ForgotPasswordMailSendDate
));
result
.
add
(
HELPER_ForgotPasswordKey
.
getAttribObject
(
getClass
(),
_ForgotPasswordKey
,
false
,
FIELD_ForgotPasswordKey
));
result
.
add
(
HELPER_Role
.
getAttribObject
(
getClass
(),
_Role
,
false
,
FIELD_Role
));
result
.
add
(
HELPER_Roles
.
getAttribObject
(
getClass
(),
_Roles
,
false
,
FIELD_Roles
));
result
.
add
(
HELPER_Phone
.
getAttribObject
(
getClass
(),
_Phone
,
false
,
FIELD_Phone
));
result
.
add
(
HELPER_VerificationMailSendDate
.
getAttribObject
(
getClass
(),
_VerificationMailSendDate
,
false
,
FIELD_VerificationMailSendDate
));
result
.
add
(
HELPER_VerificationKey
.
getAttribObject
(
getClass
(),
_VerificationKey
,
false
,
FIELD_VerificationKey
));
...
...
@@ -3453,6 +3641,24 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute Roles
*/
public
Set
<
RoleType
>
getRoles
(
CompanyUser
obj
,
Set
<
RoleType
>
original
)
{
return
original
;
}
/**
* Change the value set for attribute Roles.
* May modify the field beforehand
* Occurs before validation.
*/
public
Set
<
RoleType
>
setRoles
(
CompanyUser
obj
,
Set
<
RoleType
>
newRoles
)
throws
FieldException
{
return
newRoles
;
}
/**
* Get the attribute Phone
*/
public
String
getPhone
(
CompanyUser
obj
,
String
original
)
...
...
@@ -3708,6 +3914,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
toRole
();
}
if
(
name
.
equals
(
"Roles"
))
{
return
toRoles
();
}
if
(
name
.
equals
(
"Phone"
))
{
return
toPhone
();
...
...
@@ -3758,6 +3968,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
public
PipeLine
<
From
,
RoleType
>
toRole
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
RoleType
>(
FIELD_Role
));
}
public
PipeLine
<
From
,
Set
<
RoleType
>>
toRoles
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
Set
<
RoleType
>>(
FIELD_Roles
));
}
public
PipeLine
<
From
,
String
>
toPhone
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_Phone
));
}
public
PipeLine
<
From
,
Date
>
toVerificationMailSendDate
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
Date
>(
FIELD_VerificationMailSendDate
));
}
...
...
cmsWebApp/src/performa/orm/CompanyUser.java
View file @
bee8281b
package
performa
.
orm
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
...
...
@@ -66,6 +69,9 @@ public class CompanyUser extends BaseCompanyUser
}
secUser
.
addRole
(
Utils
.
getRole
(
Utils
.
ROLE_COMPANY_ADMIN
,
getTransaction
()));
setRoleTypes
(
RoleType
.
ADMIN
);
removeRoleTypes
(
RoleType
.
STANDARD
);
}
else
if
(
getRole
()==
RoleType
.
STANDARD
)
{
...
...
@@ -75,12 +81,38 @@ public class CompanyUser extends BaseCompanyUser
}
secUser
.
addRole
(
Utils
.
getRole
(
Utils
.
ROLE_COMPANY_USER
,
getTransaction
()));
setRoleTypes
(
RoleType
.
STANDARD
);
removeRoleTypes
(
RoleType
.
ADMIN
);
}
super
.
postRoleChange
();
}
public
void
setRoleTypes
(
RoleType
...
roleType
)
throws
FieldException
{
Set
<
RoleType
>
roles
=
getRoles
()
!=
null
?
getRoles
()
:
new
HashSet
();
roles
.
addAll
(
Arrays
.
asList
(
roleType
));
setRoles
(
roles
);
}
public
void
removeRoleTypes
(
RoleType
...
roleType
)
throws
FieldException
{
Set
<
RoleType
>
roles
=
getRoles
();
if
(
roles
!=
null
)
{
roles
.
removeAll
(
Arrays
.
asList
(
roleType
));
setRoles
(
roles
);
}
}
@Override
public
FieldWriteability
getWriteability_Role
()
{
...
...
cmsWebApp/src/performa/orm/CompanyUser.xml
View file @
bee8281b
...
...
@@ -13,16 +13,17 @@
<TABLE
name=
"oneit_sec_user_extension"
tablePrefix=
"object"
polymorphic=
"TRUE"
>
<ATTRIB
name=
"ForgotPasswordMailSendDate"
type=
"Date"
dbcol=
"forgot_password_mail_send_date"
/>
<ATTRIB
name=
"ForgotPasswordKey"
type=
"String"
dbcol=
"forgot_password_key"
length=
"10"
/>
<ATTRIB
name=
"Role"
type=
"RoleType"
dbcol=
"role_type"
mandatory=
"false"
attribHelper=
"EnumeratedAttributeHelper"
/>
<ATTRIB
name=
"Phone"
type=
"String"
dbcol=
"phone"
mandatory=
"false"
length=
"30"
/>
<ATTRIB
name=
"VerificationMailSendDate"
type=
"Date"
dbcol=
"verification_mail_send_date"
/>
<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=
"StripeReference"
type=
"String"
dbcol=
"stripe_reference"
length=
"100"
/>
<ATTRIB
name=
"StripeSubscription"
type=
"String"
dbcol=
"stripe_subscription"
length=
"100"
/>
<ATTRIB
name=
"ForgotPasswordMailSendDate"
type=
"Date"
dbcol=
"forgot_password_mail_send_date"
/>
<ATTRIB
name=
"ForgotPasswordKey"
type=
"String"
dbcol=
"forgot_password_key"
length=
"10"
/>
<ATTRIB
name=
"Role"
type=
"RoleType"
dbcol=
"role_type"
mandatory=
"false"
attribHelper=
"EnumeratedAttributeHelper"
/>
<ATTRIB
name=
"Roles"
type=
"Set<RoleType>"
dbcol=
"roles"
mandatory=
"false"
attribHelper=
"DelimitedEnumsAttributeHelper"
attribHelperInstance=
"new DelimitedEnumsAttributeHelper (RoleType.FACTORY_RoleType)"
/>
<ATTRIB
name=
"Phone"
type=
"String"
dbcol=
"phone"
mandatory=
"false"
length=
"30"
/>
<ATTRIB
name=
"VerificationMailSendDate"
type=
"Date"
dbcol=
"verification_mail_send_date"
/>
<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=
"StripeReference"
type=
"String"
dbcol=
"stripe_reference"
length=
"100"
/>
<ATTRIB
name=
"StripeSubscription"
type=
"String"
dbcol=
"stripe_subscription"
length=
"100"
/>
<SINGLEREFERENCE
name=
"User"
type=
"SecUser"
dbcol=
"user_id"
backreferenceName=
"Extensions"
inSuper=
'TRUE'
/>
<SINGLEREFERENCE
name=
"Company"
type=
"Company"
dbcol=
"company_id"
backreferenceName=
"Users"
/>
...
...
cmsWebApp/src/performa/orm/CompanyUserPersistenceMgr.java
View file @
bee8281b
...
...
@@ -31,6 +31,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private
Date
dummyForgotPasswordMailSendDate
;
private
String
dummyForgotPasswordKey
;
private
RoleType
dummyRole
;
private
Set
<
RoleType
>
dummyRoles
;
private
String
dummyPhone
;
private
Date
dummyVerificationMailSendDate
;
private
String
dummyVerificationKey
;
...
...
@@ -44,6 +45,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private
static
final
DefaultAttributeHelper
HELPER_ForgotPasswordMailSendDate
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_ForgotPasswordKey
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
EnumeratedAttributeHelper
HELPER_Role
=
new
EnumeratedAttributeHelper
(
RoleType
.
FACTORY_RoleType
);
private
static
final
DelimitedEnumsAttributeHelper
HELPER_Roles
=
new
DelimitedEnumsAttributeHelper
(
RoleType
.
FACTORY_RoleType
);
private
static
final
DefaultAttributeHelper
HELPER_Phone
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_VerificationMailSendDate
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_VerificationKey
=
DefaultAttributeHelper
.
INSTANCE
;
...
...
@@ -60,6 +62,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
dummyForgotPasswordMailSendDate
=
(
Date
)(
HELPER_ForgotPasswordMailSendDate
.
initialise
(
dummyForgotPasswordMailSendDate
));
dummyForgotPasswordKey
=
(
String
)(
HELPER_ForgotPasswordKey
.
initialise
(
dummyForgotPasswordKey
));
dummyRole
=
(
RoleType
)(
HELPER_Role
.
initialise
(
dummyRole
));
dummyRoles
=
(
Set
<
RoleType
>)(
HELPER_Roles
.
initialise
(
dummyRoles
));
dummyPhone
=
(
String
)(
HELPER_Phone
.
initialise
(
dummyPhone
));
dummyVerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
initialise
(
dummyVerificationMailSendDate
));
dummyVerificationKey
=
(
String
)(
HELPER_VerificationKey
.
initialise
(
dummyVerificationKey
));
...
...
@@ -70,7 +73,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
}
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.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.stripe_reference, {PREFIX}oneit_sec_user_extension.stripe_subscription, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_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.stripe_reference, {PREFIX}oneit_sec_user_extension.stripe_subscription, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_id, 1 AS commasafe "
;
private
String
SELECT_JOINS
=
""
;
public
BaseBusinessClass
fetchByID
(
ObjectID
id
,
PersistentSetCollection
allPSets
,
RDBMSPersistenceContext
context
,
SQLManager
sqlMgr
)
throws
SQLException
,
StorageException
...
...
@@ -125,6 +128,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_ForgotPasswordMailSendDate
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_ForgotPasswordKey
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_Role
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_Roles
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_Phone
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_VerificationMailSendDate
)||
!
oneit_sec_user_extensionPSet
.
containsAttrib
(
CompanyUser
.
FIELD_VerificationKey
)||
...
...
@@ -232,10 +236,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 = ?, phone = ?, verification_mail_send_date = ?, verification_key = ?, is_account_verified = ?, is_email_changed = ?, stripe_reference = ?, stripe_subscription = ?, user_id = ? , company_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 = ?, stripe_reference = ?, stripe_subscription = ?, user_id = ? , company_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_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_StripeReference
.
getForSQL
(
dummyStripeReference
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeSubscription
))).
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
(
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_StripeReference
.
getForSQL
(
dummyStripeReference
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeSubscription
))).
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
(
objectID
.
longID
()).
listEntry
(
obj
.
getObjectLastModified
()).
toList
().
toArray
());
if
(
rowsUpdated
!=
1
)
{
...
...
@@ -655,6 +659,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_ForgotPasswordMailSendDate
,
HELPER_ForgotPasswordMailSendDate
.
getFromRS
(
dummyForgotPasswordMailSendDate
,
r
,
"forgot_password_mail_send_date"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_ForgotPasswordKey
,
HELPER_ForgotPasswordKey
.
getFromRS
(
dummyForgotPasswordKey
,
r
,
"forgot_password_key"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_Role
,
HELPER_Role
.
getFromRS
(
dummyRole
,
r
,
"role_type"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_Roles
,
HELPER_Roles
.
getFromRS
(
dummyRoles
,
r
,
"roles"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_Phone
,
HELPER_Phone
.
getFromRS
(
dummyPhone
,
r
,
"phone"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_VerificationMailSendDate
,
HELPER_VerificationMailSendDate
.
getFromRS
(
dummyVerificationMailSendDate
,
r
,
"verification_mail_send_date"
));
oneit_sec_user_extensionPSet
.
setAttrib
(
CompanyUser
.
FIELD_VerificationKey
,
HELPER_VerificationKey
.
getFromRS
(
dummyVerificationKey
,
r
,
"verification_key"
));
...
...
@@ -681,10 +686,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, phone, verification_mail_send_date, verification_key, is_account_verified, is_email_changed, stripe_reference, stripe_subscription, user_id, company_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, stripe_reference, stripe_subscription, user_id, company_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_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_StripeReference
.
getForSQL
(
dummyStripeReference
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeSubscription
)))
.
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
(
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_StripeReference
.
getForSQL
(
dummyStripeReference
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
oneit_sec_user_extensionPSet
.
getAttrib
(
CompanyUser
.
FIELD_StripeSubscription
)))
.
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
(
objectID
.
longID
()).
listEntry
(
context
.
getTag
(
obj
)).
toList
().
toArray
());
oneit_sec_user_extensionPSet
.
setStatus
(
PersistentSetStatus
.
PROCESSED
);
}
...
...
cmsWebApp/src/performa/orm/types/RoleType.java
View file @
bee8281b
...
...
@@ -24,9 +24,13 @@ public class RoleType extends AbstractEnumerated
public
static
final
RoleType
ADMIN
=
new
RoleType
(
"ADMIN"
,
"ADMIN"
,
"Admin"
,
false
);
public
static
final
RoleType
STANDARD
=
new
RoleType
(
"STANDARD"
,
"STANDARD"
,
"Standard"
,
false
);
public
static
final
RoleType
OWNER
=
new
RoleType
(
"OWNER"
,
"OWNER"
,
"Owner"
,
false
);
public
static
final
RoleType
BILLING
=
new
RoleType
(
"BILLING"
,
"BILLING"
,
"Billing"
,
false
);
private
static
final
RoleType
[]
allRoleTypes
=
new
RoleType
[]
{
ADMIN
,
STANDARD
};
new
RoleType
[]
{
ADMIN
,
STANDARD
,
OWNER
,
BILLING
};
private
static
RoleType
[]
getAllRoleTypes
()
...
...
cmsWebApp/src/performa/orm/types/RoleType.xml
View file @
bee8281b
...
...
@@ -6,6 +6,8 @@
<VALUE
name=
"ADMIN"
value=
"ADMIN"
description=
"Admin"
/>
<VALUE
name=
"STANDARD"
value=
"STANDARD"
description=
"Standard"
/>
<VALUE
name=
"OWNER"
value=
"OWNER"
description=
"Owner"
/>
<VALUE
name=
"BILLING"
value=
"BILLING"
description=
"Billing"
/>
</CONSTANT>
...
...
cmsWebApp/webroot/extensions/adminportal/manage_users.jsp
View file @
bee8281b
...
...
@@ -147,7 +147,7 @@
</div>
</div>
<div class="m-user-right">
<oneit:ormEnum obj="<%= companyUser %>" attributeName="Role" cssClass="form-control user-role"/>
<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() %>" />
...
...
cmsWebApp/webroot/extensions/performa/upgrades/20180124_Alter_CompanyUser.xml
0 → 100644
View file @
bee8281b
<?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=
"roles"
type=
"String"
nullable=
"true"
length=
"200"
/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
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