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

Commit cc21573

Browse files
committed
BUGR-5862 - Fix Login Issue and TC Staff permission to view contest details
1 parent ce60dda commit cc21573

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/main/com/topcoder/web/common/BaseProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected void setIsNextPageInContext(boolean flag) {
155155
* @return boolean
156156
*/
157157
protected boolean userLoggedIn() {
158-
return !auth.getUser().isAnonymous();
158+
return !auth.getActiveUser().isAnonymous();
159159
}
160160

161161
/**

src/main/com/topcoder/web/studio/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public class Constants implements WebConstants {
108108
public static final String DOCUMENT_TYPE_ID = "doctid";
109109
public static final String DOCUMENT = "doc";
110110
public static final long CONTEST_ADMIN_ROLE_ID = 2040;
111+
public static final long TC_STUFF_ROLE_ID = 2087;
111112
public static final String FILE_TYPE = "ft_";
112113
public static final String SUBMISSION_RANK = "srank";
113114
public static final String REG_CONFIRM = "rconfirm";

src/main/com/topcoder/web/studio/controller/request/ViewContestDetails.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected void dbProcessing() throws Exception {
129129

130130
// Check if the user has permissions to see contest details even if it's still not active
131131
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()))
133133
|| hasPermissions(userId, cid)) {
134134
getRequest().setAttribute("contest", contest);
135135
} else {

src/main/com/topcoder/web/studio/util/Util.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ public static boolean isAdmin(long userId) throws Exception {
125125
return found;
126126
}
127127

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+
128137
/**
129138
* Check if passed user has role from list in given contest.
130139
*

0 commit comments

Comments
 (0)