Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit bfb3916

Browse files
authored
Merge pull request #12 from topcoder-platform/dev
promote to master
2 parents 831d27a + fc69ce1 commit bfb3916

33 files changed

+664
-133
lines changed

.deploy/circleci/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All files and directories under this directory will be copy to tc-website root on circleci env before build

build_distui.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<project name="topcoder" default="main" basedir=".">
2+
<property environment="env"/>
23
<property name="Name" value="TopCoder"/>
34
<property name="build" value="build"/>
45
<property name="war.dir" value="${build}/wars"/>
@@ -23,11 +24,10 @@
2324
<property name="common.jar" value="${bin}/tcwebcommon.jar"/>
2425
<property name="tccache.jar" value="${jars.dir}/tcs/tc_cache/1.0.0/tc_cache.jar"/>
2526
<property name="web" value="src/main/com/topcoder/web"/>
26-
<property name="jboss_home" value="/home/distui/jboss-4.2.0.GA"/>
27-
<property name="jboss_deploy" value="${jboss_home}/server/distui/deploy"/>
28-
<property name="jboss_lib" value="${jboss_home}/server/distui/lib"/>
29-
<property name="jboss_conf" value="${jboss_home}/server/distui/conf"/>
30-
<property environment="env"/>
27+
<property name="jboss_home" value="${env.JBOSS_HOME}"/>
28+
<property name="jboss_deploy" value="${jboss_home}/server/all/deploy"/>
29+
<property name="jboss_lib" value="${jboss_home}/server/all/lib"/>
30+
<property name="jboss_conf" value="${jboss_home}/server/all/conf"/>
3131

3232
<property name="deprecation" value="true"/>
3333
<property name="debug" value="true"/>

build_mm.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
<property name="long.jar" value="${bin}/long.jar"/>
3232
<property name="web" value="src/main/com/topcoder/web"/>
3333
<property name="jboss_home" value="${env.JBOSS_HOME}"/>
34-
<property name="jboss_deploy" value="${jboss_home}/server/mm/deploy"/>
35-
<property name="jboss_lib" value="${jboss_home}/server/mm/lib"/>
36-
<property name="jboss_conf" value="${jboss_home}/server/mm/conf"/>
34+
<property name="jboss_deploy" value="${jboss_home}/server/all/deploy"/>
35+
<property name="jboss_lib" value="${jboss_home}/server/all/lib"/>
36+
<property name="jboss_conf" value="${jboss_home}/server/all/conf"/>
3737

3838
<property name="deprecation" value="true"/>
3939
<property name="debug" value="true"/>
@@ -256,9 +256,7 @@ copy in the classpath
256256

257257
<target name="expand">
258258
<!-- copy the libs -->
259-
<copy todir="${jboss_lib}" file="${external.jars.dir}/ifxjdbc-3.00.JC3.jar"/>
260-
<copy todir="${jboss_lib}" file="${jboss_home}/server/all/lib/jgroups.jar"/>
261-
<copy todir="${jboss_lib}" file="${jboss_home}/server/all/lib/jboss-cache-jdk50.jar"/>
259+
<copy todir="${jboss_lib}" file="${jars.dir}/ifxjdbc.jar"/>
262260

263261

264262
<!-- these jars are needed by the ejb's. really we should build a web app that contains these libs -->

build_tc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@
847847
<fileset dir="${jars.dir}/tcs/json_object/1.0">
848848
<include name="json_object.jar"/>
849849
</fileset>
850-
<fileset dir="${jars.dir}/tcs">
850+
<fileset dir="${jars.dir}/tcs/ldap_sdk_interface/1.0.2">
851851
<include name="ldap_sdk_interface.jar"/>
852852
</fileset>
853853
<fileset dir="${jars.dir}">

circle.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
machine:
2+
services:
3+
- docker
4+
5+
checkout:
6+
pre:
7+
- git clone https://github.com/topcoder-platform/tc-website-glue glue
8+
- git clone https://github.com/topcoder-platform/tc-website-shared shared
9+
- git clone https://github.com/topcoder-platform/tc-website-external-artifacts external-artifacts
10+
11+
12+
test:
13+
override:
14+
- cp -Rf .deploy/circleci/* . && docker run -v ${HOME}:/root/tc-platform appiriodevops/tc-website:build

resources/cache.properties

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
cache.primary = localhost:8501
1+
#cache.primary = localhost:8501
22
#cache.secondary = 63.118.154.182:8502
33

44
# allow at most 25000 items in the cache
5-
cache.size = 25000
5+
#cache.size = 25000
66
# sync every 10 seconds
7-
cache.synctime = 10000
7+
#cache.synctime = 10000
88

99
# check every minute
10-
cache.expirecheck = 60000
10+
#cache.expirecheck = 60000
1111
# expire after 10 hours
12-
cache.expiretime = 3600000
12+
#cache.expiretime = 3600000
1313

1414
### Use the following configurations to use JBoss Cache as cache ###
1515

16-
host_url = env.topcoder.com:2199
17-
jndi_name = TCCache
18-
cache_admin_jndi_name = TCCacheAdmin
19-
cache_client_class=com.topcoder.web.common.cache.JbossCacheClient
16+
#host_url = env.topcoder.com:2199
17+
#jndi_name = TCCache
18+
#cache_admin_jndi_name = TCCacheAdmin
19+
#cache_client_class=com.topcoder.web.common.cache.JbossCacheClient
2020

2121
### Use the following configurations to use REDIS as cache ###
22-
23-
#cache_client_class=com.topcoder.web.common.cache.RedisCacheClient
24-
#tc_subject_cache_address_class=com.topcoder.web.common.cache.address.TCSubjectAddress
25-
#request_cache_address_class=com.topcoder.web.common.cache.address.RequestAddress
26-
22+
#
23+
cache_client_class=com.topcoder.web.common.cache.RedisCacheClient
24+
tc_subject_cache_address_class=com.topcoder.web.common.cache.address.TCSubjectAddress
25+
request_cache_address_class=com.topcoder.web.common.cache.address.RequestAddress
26+
#
2727
#format: redis://username:[email protected]:6389
28-
#redis.uri=redis://cache.topcoder.com:6379
29-
30-
31-
#redis.maxTotalConnections=50
32-
#redis.maxIdleConnections=30
33-
#redis.minIdleConnections=1
28+
redis.uri=redis://env.topcoder.com:6379
29+
#
30+
#
31+
redis.maxTotalConnections=50
32+
redis.maxIdleConnections=30
33+
redis.minIdleConnections=1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE hibernate-mapping PUBLIC
3+
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
4+
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
5+
6+
<hibernate-mapping package="com.topcoder.web.common.model">
7+
8+
<class name="UserSSOLogin" table="common_oltp:user_sso_login" >
9+
<composite-id name="id" class="UserSSOLogin$Identifier">
10+
<key-property name="userId" column="user_id" />
11+
<key-property name="providerId" column="provider_id" />
12+
</composite-id>
13+
14+
<property name="ssoUserName" column="sso_user_name" access="field"/>
15+
<property name="ssoEmail" column="email" access="field"/>
16+
<property name="ssoUserId" column="sso_user_id" access="field"/>
17+
</class>
18+
</hibernate-mapping>

resources/reg/hibernate.cfg.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@
154154
<mapping class="com.topcoder.web.common.model.educ.ProfessorStatus"/>
155155

156156
<mapping resource="com/topcoder/web/common/model/UserSocialLogin.hbm.xml"/>
157+
158+
<!-- 2017.04.24 [SEG-42] Block adding additional social logins to account -->
159+
<mapping resource="com/topcoder/web/common/model/UserSSOLogin.hbm.xml"/>
160+
157161
<mapping resource="com/topcoder/web/common/model/UserApiSpin.hbm.xml"/>
158162

159163
<mapping resource="com/topcoder/web/common/model/DocuSignEnvelope.hbm.xml"/>

resources/taglib/tc-webtags.tld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@
185185
<required>false</required>
186186
<rtexprvalue>true</rtexprvalue>
187187
</attribute>
188+
<attribute>
189+
<name>disabled</name>
190+
<required>false</required>
191+
<rtexprvalue>true</rtexprvalue>
192+
</attribute>
188193
</tag>
189194

190195
<tag>

src/main/com/topcoder/web/common/dao/DAOFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ public interface DAOFactory {
234234
*/
235235
UserSocialLoginDAO getUserSocialLoginDAO();
236236

237+
/**
238+
* Gets the instance of {@link UserSSOLoginDAO}.
239+
*
240+
* @return the dao.
241+
*/
242+
UserSSOLoginDAO getUserSSOLoginDAO();
243+
237244
/**
238245
* Gets the instance of {@link UserApiSpinDAO}.
239246
*
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (C) 2017 TopCoder Inc., All Rights Reserved.
3+
*/
4+
package com.topcoder.web.common.dao;
5+
6+
import com.topcoder.web.common.model.UserSSOLogin;
7+
8+
import java.util.List;
9+
10+
/**
11+
* <p>
12+
* An interface for the UserSSOLogin DAO.
13+
* </p>
14+
*
15+
* <p>
16+
* <strong>Thread safety:</strong> This class is thread-safe.
17+
* </p>
18+
*
19+
* @author kht.tc
20+
* @version 1.0
21+
*/
22+
public interface UserSSOLoginDAO extends GenericDAO<UserSSOLogin, UserSSOLogin.Identifier> {
23+
/**
24+
* Find UserSSOLogin by user id.
25+
*
26+
* @param userId the user id
27+
* @return retrieved list
28+
*/
29+
List<UserSSOLogin> findByUserId(long userId);
30+
UserSSOLogin findByProviderIdAndSSOUserId(long providerId, String ssoUserId);
31+
}

src/main/com/topcoder/web/common/dao/hibernate/DAOFactoryHibernate.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,15 @@ public UserSocialLoginDAO getUserSocialLoginDAO() {
379379
return new UserSocialLoginDAOHibernate();
380380
}
381381

382+
/**
383+
* Gets the instance of {@link UserSSOLoginDAO}.
384+
*
385+
* @return the dao.
386+
*/
387+
public UserSSOLoginDAO getUserSSOLoginDAO() {
388+
return new UserSSOLoginDAOHibernate();
389+
}
390+
382391
/**
383392
* Gets the instance of {@link UserApiSpinDAO}.
384393
*
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2017 TopCoder Inc., All Rights Reserved.
3+
*/
4+
package com.topcoder.web.common.dao.hibernate;
5+
6+
import com.topcoder.web.common.dao.UserSSOLoginDAO;
7+
import com.topcoder.web.common.model.UserSSOLogin;
8+
import org.hibernate.Criteria;
9+
import org.hibernate.Query;
10+
import org.hibernate.criterion.Restrictions;
11+
12+
import java.util.List;
13+
14+
/**
15+
* <p>
16+
* An implementation for the UserSSOLogin DAO.
17+
* </p>
18+
*
19+
* <p>
20+
* <strong>Thread safety:</strong> This class is thread-safe.
21+
* </p>
22+
*
23+
* @author kht.tc
24+
* @version 1.0
25+
*/
26+
public class UserSSOLoginDAOHibernate extends GenericBase<UserSSOLogin, UserSSOLogin.Identifier>
27+
implements UserSSOLoginDAO {
28+
29+
/**
30+
* Find UserSSOLogin by user id.
31+
*
32+
* @param userId the user id
33+
* @return retrieved list
34+
*/
35+
public List<UserSSOLogin> findByUserId(long userId) {
36+
Query q = getSession().createQuery("from UserSSOLogin " +
37+
" where id.userId = " + userId ).setCacheable(false);
38+
39+
return q.list();
40+
}
41+
42+
public UserSSOLogin findByProviderIdAndSSOUserId(long providerId, String ssoUserId) {
43+
Criteria c = getSession().createCriteria(UserSSOLogin.class)
44+
.add(Restrictions.eq("ssoUserId", ssoUserId))
45+
.add(Restrictions.eq("id.providerId", providerId));
46+
List ret = c.list();
47+
return ret.isEmpty() ? null : (UserSSOLogin) ret.get(0);
48+
49+
}
50+
}

src/main/com/topcoder/web/common/dao/querytool/DAOFactoryQueryTool.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ public UserSocialLoginDAO getUserSocialLoginDAO() {
366366
throw new RuntimeException("Not supported");
367367
}
368368

369+
/**
370+
* Gets the instance of {@link UserSSOLoginDAO}.
371+
*
372+
* @return nothing, will throw exception.
373+
*/
374+
public UserSSOLoginDAO getUserSSOLoginDAO() {
375+
throw new RuntimeException("Not supported");
376+
}
377+
369378
/**
370379
* Gets the instance of {@link UserApiSpinDAO}.
371380
*
@@ -405,4 +414,5 @@ public EmailRequestDAO getEmailRequestDAO() {
405414
public DocuSignEnvelopeDAO getDocuSignEnvelopeDAO() {
406415
throw new RuntimeException("Not supported");
407416
}
417+
408418
}

src/main/com/topcoder/web/common/model/PaymentMethod.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44
/**
55
* A class to hold Payment Method data.
66
*
7-
* @author VolodymyrK
7+
* <p>
8+
* Version 1.1 (Topcoder - Add New Payment Provider) Change notes:
9+
* <ol>
10+
* <li>Added eligible attribute to determinate whether the payment method is allowed or not.</li>
11+
* </ol>
12+
* </p>
13+
*
14+
* @author VolodymyrK, TCSCODER
15+
* @version 1.1
816
*/
917
public class PaymentMethod extends Base {
1018

1119
private Long id;
1220
private String name;
21+
private boolean eligible = true;
1322

1423
public PaymentMethod() {
1524
}
@@ -30,4 +39,12 @@ public void setName(String name) {
3039
this.name = name;
3140
}
3241

42+
public boolean isEligible() {
43+
return eligible;
44+
}
45+
46+
public void setEligible(boolean eligible) {
47+
this.eligible = eligible;
48+
}
49+
3350
}

0 commit comments

Comments
 (0)