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

Commit 1a9c1ba

Browse files
committed
Merge pull request #63 from cloudspokes/technology-2014-11-13
Technology 2014 11 13
2 parents a4e274d + 813d648 commit 1a9c1ba

File tree

19 files changed

+551
-93
lines changed

19 files changed

+551
-93
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Setup on VM:
77
* Delete the whole directory /home/direct/direct
88
* Git Clone the direct-app repo into folder /home/direct/direct.
99
* Copy the back up *.properties files back to /home/direct/direct
10+
* Among the *.properties, update topcoder_global.properties, add line 'direct_service_libdir=${libdir}/tcs/ejb' after tcs_libdir property
11+
* Make sure JDK7 is used: run
12+
* + export JAVA_HOME=/opt/jdk1.7.0_17
13+
* + export PATH=/opt/jdk1.7.0_17/bin:$PATH
1014

1115
Setup on Local env - Refer to http://apps.topcoder.com/wiki/display/docs/TC+Direct+Setup+Guide
1216
* Instead of using SVN, you will use the codes from this git repo
@@ -16,7 +20,7 @@ VM Info:
1620
* http://apps.topcoder.com/wiki/display/docs/VM+Image+2.5
1721

1822
Build/Compile
19-
* run 'ant'
23+
* run 'ant deploy'
2024

2125
Deploy:
2226
* simply run 'ant deploy' to build all the components and the direct and deploy the direct to jboss

components/cockpit_facade_util/build-dependencies.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676

7777
<property name="xercesImpl.jar" value="${jboss_home}/lib/endorsed/xercesImpl.jar" />
7878

79+
<property name="spring.jar" value="${ext_libdir}/spring/spring.jar"/>
80+
81+
7982
<path id="component.tcs-dependencies">
8083
<pathelement location="${base_exception.jar}" />
8184
<pathelement location="${logging_wrapper.jar}" />
@@ -98,6 +101,7 @@
98101
<pathelement location="${jbossall-client.jar}" />
99102
<pathelement location="${jboss-jaxws.jar}" />
100103
<pathelement location="${jaxb-api.jar}" />
104+
<pathelement location="${spring.jar}" />
101105
</path>
102106

103107
<path id="component.test.3rdParty-dependencies">
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (C) 2014 TopCoder Inc., All Rights Reserved.
3+
*/
4+
package com.topcoder.service.util;
5+
6+
import org.springframework.beans.BeansException;
7+
import org.springframework.context.ApplicationContext;
8+
import org.springframework.context.ApplicationContextAware;
9+
10+
/**
11+
* <p>Spring Application Context share the spring application context</p>
12+
*
13+
* @author TCSASSEMBLER
14+
* @version 1.0
15+
*/
16+
public class SpringApplicationContext implements ApplicationContextAware {
17+
18+
private static ApplicationContext CONTEXT;
19+
20+
/**
21+
* This method is called from within the ApplicationContext once it is
22+
* done starting up, it will stick a reference to itself into this bean.
23+
* @param context a reference to the ApplicationContext.
24+
*/
25+
public void setApplicationContext(ApplicationContext context) throws BeansException {
26+
CONTEXT = context;
27+
}
28+
29+
/**
30+
* This is about the same as context.getBean("beanName"), except it has its
31+
* own static handle to the Spring context, so calling this method statically
32+
* will give access to the beans by name in the Spring application context.
33+
* As in the context.getBean("beanName") call, the caller must cast to the
34+
* appropriate target class. If the bean does not exist, then a Runtime error
35+
* will be thrown.
36+
* @param beanName the name of the bean to get.
37+
* @return an Object reference to the named bean.
38+
*/
39+
public static Object getBean(String beanName) {
40+
return CONTEXT.getBean(beanName);
41+
}
42+
}

conf/web/WEB-INF/applicationContext.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
<tx:annotation-driven transaction-manager="transactionManager" />
2323

24+
<bean id="springApplicationContext" class="com.topcoder.service.util.SpringApplicationContext"/>
25+
2426
<!-- Services -->
2527
<bean id="projectServiceFacade" class="org.springframework.jndi.JndiObjectFactoryBean">
2628
<property name="jndiName" value="remote/ProjectServiceFacadeBean"/>

conf/web/WEB-INF/struts.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,48 +869,56 @@
869869
<interceptor-ref name="securedProjectPreProcessorStack"/>
870870
<result name="success" type="json" />
871871
<result name="error" type="json" />
872+
<result name="permissionDenied" type="json"/>
872873
</action>
873874

874875
<action name="saveClientProjectManagers" class="saveCockpitProjectSettingAction"
875876
method="saveClientProjectManagers">
876877
<interceptor-ref name="securedProjectPreProcessorStack"/>
877878
<result name="success" type="json"/>
878879
<result name="error" type="json"/>
880+
<result name="permissionDenied" type="json"/>
881+
879882
</action>
880883

881884
<action name="saveTopCoderAccountManagers" class="saveCockpitProjectSettingAction"
882885
method="saveTopCoderAccountManagers">
883886
<interceptor-ref name="securedProjectPreProcessorStack"/>
884887
<result name="success" type="json"/>
885888
<result name="error" type="json"/>
889+
<result name="permissionDenied" type="json"/>
886890
</action>
887891

888892
<action name="saveTopCoderManagers" class="saveCockpitProjectSettingAction"
889893
method="saveTopCoderManagers">
890894
<interceptor-ref name="securedProjectPreProcessorStack"/>
891895
<result name="success" type="json"/>
892896
<result name="error" type="json"/>
897+
<result name="permissionDenied" type="json"/>
893898
</action>
894899

895900
<action name="saveAppirioManagers" class="saveCockpitProjectSettingAction"
896901
method="saveAppirioManagers">
897902
<interceptor-ref name="securedProjectPreProcessorStack"/>
898903
<result name="success" type="json"/>
899904
<result name="error" type="json"/>
905+
<result name="permissionDenied" type="json"/>
900906
</action>
901907

902908
<action name="addNewCustomMetadataKey" class="saveCockpitProjectSettingAction"
903909
method="addNewCustomMetadataKey">
904910
<interceptor-ref name="securedProjectPreProcessorStack"/>
905911
<result name="success" type="json"/>
906912
<result name="error" type="json"/>
913+
<result name="permissionDenied" type="json"/>
907914
</action>
908915

909916
<action name="removeProjectBillingAccount" class="saveCockpitProjectSettingAction"
910917
method="removeProjectBillingAccount">
911918
<interceptor-ref name="securedProjectPreProcessorStack"/>
912919
<result name="success" type="json"/>
913920
<result name="error" type="json"/>
921+
<result name="permissionDenied" type="json"/>
914922
</action>
915923

916924
<action name="associateProjectBillingAccount" class="saveCockpitProjectSettingAction"
@@ -925,13 +933,15 @@
925933
<interceptor-ref name="securedProjectPreProcessorStack"/>
926934
<result name="success" type="json"/>
927935
<result name="error" type="json"/>
936+
<result name="permissionDenied" type="json"/>
928937
</action>
929938

930939
<action name="saveContestsNotificationsForUser" class="saveCockpitProjectSettingAction"
931940
method="saveContestsNotificationsForUser">
932941
<interceptor-ref name="securedProjectPreProcessorStack"/>
933942
<result name="success" type="json"/>
934943
<result name="error" type="json"/>
944+
<result name="permissionDenied" type="json"/>
935945
</action>
936946

937947
<action name="calendar" class="com.topcoder.direct.services.view.action.dashboard.CalendarAction">

services/game_plan_service/src/java/main/com/topcoder/service/gameplan/ejb/GamePlanServiceBean.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,15 @@
129129
* </ol>
130130
* </p>
131131
*
132+
* <p>
133+
* Version 1.4 (TopCoder Direct - Add Group Permission Logic and project full permission checking)
134+
* <ul>
135+
* <li>Updated {@link #PERMISSION_CHECKING} to add customer admin logic</li>
136+
* </ul>
137+
* </p>
138+
*
132139
* @author saarixx, FireIce, isv, lmmortal, GreatKevin, TCSASSEMBLER, freegod
133-
* @version 1.3
140+
* @version 1.4
134141
*/
135142
@Stateless
136143
public class GamePlanServiceBean implements GamePlanServiceLocal, GamePlanServiceRemote {
@@ -262,7 +269,35 @@ public class GamePlanServiceBean implements GamePlanServiceLocal, GamePlanServic
262269
" AND sg.archived = 0\n" +
263270
" AND ttc.client_status_id = 1\n" +
264271
" AND tdp.project_id = p.tc_direct_project_id\n" +
265-
" ))";
272+
" )\n" +
273+
"OR EXISTS (\n"+
274+
" SELECT \n"+
275+
" tdp.project_id as tc_direct_project_id\n"+
276+
" FROM project_info pi\n"+
277+
" INNER JOIN tc_direct_project tdp ON p.tc_direct_project_id = tdp.project_id\n"+
278+
" INNER JOIN tt_client_project cp ON cp.project_id = pi.value\n"+
279+
" INNER JOIN tt_client c ON c.client_id = cp.client_id\n"+
280+
" INNER JOIN customer_administrator ca ON ca.client_id = c.client_id\n"+
281+
" WHERE pi.project_info_type_id = 32\n"+
282+
" AND c.status = 1\n"+
283+
" AND c.is_deleted = 0\n"+
284+
" AND pi.project_id = p.project_id\n"+
285+
" AND tdp.project_id = p.tc_direct_project_id\n"+
286+
" AND ca.user_id = :userId \n"+
287+
" )\n" +
288+
"OR EXISTS (\n" +
289+
" SELECT tdp.project_id AS tc_direct_project_id\n" +
290+
" FROM tc_direct_project tdp\n" +
291+
" INNER JOIN direct_project_account dpa ON tdp.project_id = dpa.project_id\n" +
292+
" INNER JOIN tt_project ttp ON dpa.billing_account_id = ttp.project_id\n" +
293+
" INNER JOIN tt_client_project ttcp ON ttp.project_id = ttcp.project_id\n" +
294+
" INNER JOIN tt_client ttc ON ttcp.client_id = ttc.client_id\n" +
295+
" INNER JOIN customer_administrator ca ON ca.client_id = ttc.client_id\n" +
296+
" WHERE ttc.status = 1\n" +
297+
" AND ttc.is_deleted = 0\n" +
298+
" AND tdp.project_id = p.tc_direct_project_id\n" +
299+
" AND ca.user_id = :userId \n" +
300+
" ))\n";
266301

267302
/**
268303
* Represents the name for active status.

services/permission_service_facade/build-dependencies.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117

118118
<property name="security.jar" value="${tcs_libdir}/security/1.0/security.jar"/>
119119

120+
<property name="topcoder_security_groups.jar" value="${tcs_libdir}/topcoder_security_groups/1.0.0/topcoder_security_groups.jar"/>
121+
120122

121123
<!-- Direct Dependencies -->
122124

@@ -229,6 +231,7 @@
229231
<pathelement location="${auditor.jar}"/>
230232
<pathelement location="${search_builder.jar}"/>
231233
<pathelement location="${typesafe_enum.jar}"/>
234+
<pathelement location="${topcoder_security_groups.jar}"/>
232235
<pathelement location="${project_service.jar}"/>
233236
<pathelement location="${jbossws-client.jar}"/>
234237
<pathelement location="${activation.jar}"/>

0 commit comments

Comments
 (0)