This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed
src/main/com/topcoder/web Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ protected void setIsNextPageInContext(boolean flag) {
155
155
* @return boolean
156
156
*/
157
157
protected boolean userLoggedIn () {
158
- return !auth .getUser ().isAnonymous ();
158
+ return !auth .getActiveUser ().isAnonymous ();
159
159
}
160
160
161
161
/**
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ public class Constants implements WebConstants {
108
108
public static final String DOCUMENT_TYPE_ID = "doctid" ;
109
109
public static final String DOCUMENT = "doc" ;
110
110
public static final long CONTEST_ADMIN_ROLE_ID = 2040 ;
111
+ public static final long TC_STUFF_ROLE_ID = 2087 ;
111
112
public static final String FILE_TYPE = "ft_" ;
112
113
public static final String SUBMISSION_RANK = "srank" ;
113
114
public static final String REG_CONFIRM = "rconfirm" ;
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ protected void dbProcessing() throws Exception {
129
129
130
130
// Check if the user has permissions to see contest details even if it's still not active
131
131
long userId = getUser ().getId ();
132
- if (Util .isAdmin (userId ) || (String .valueOf (userId ).equals (contest .getCreateUserId ()))
132
+ if (Util .isAdmin (userId ) || Util . isTCStuff ( userId ) || (String .valueOf (userId ).equals (contest .getCreateUserId ()))
133
133
|| hasPermissions (userId , cid )) {
134
134
getRequest ().setAttribute ("contest" , contest );
135
135
} else {
Original file line number Diff line number Diff line change @@ -125,6 +125,15 @@ public static boolean isAdmin(long userId) throws Exception {
125
125
return found ;
126
126
}
127
127
128
+ public static boolean isTCStuff (long userId ) throws Exception {
129
+ TCSubject subject = SecurityHelper .getUserSubject (userId );
130
+ boolean found = false ;
131
+ for (Iterator it = subject .getPrincipals ().iterator (); it .hasNext () && !found ;) {
132
+ found = ((TCPrincipal ) it .next ()).getId () == Constants .TC_STUFF_ROLE_ID ;
133
+ }
134
+ return found ;
135
+ }
136
+
128
137
/**
129
138
* Check if passed user has role from list in given contest.
130
139
*
You can’t perform that action at this time.
0 commit comments