Commit 0e450ce2 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette

Added restriction to dropdown menu options

Fixed some typos and temporary statements
Signed-off-by: Bruno Nocera Zanette's avatarBruno Nocera Zanette <brunonzanette@gmail.com>
parent f20ff8dc
......@@ -29,6 +29,7 @@ import br.ufpr.c3sl.sapos.models.people.Student;
import br.ufpr.c3sl.sapos.models.scholar.enums.LanguageKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationStatus;
import br.ufpr.c3sl.sapos.models.util.PermissionProvider;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
......@@ -159,8 +160,7 @@ public class Registration {
}
public static Collection<Registration> findStudentRegistration() {
// String studentId = PermissionProvider.getIdFromLoggedInStudent();
String studentId="7559";
String studentId = PermissionProvider.getIdFromLoggedInStudent();
return entityManager().createNativeQuery(
"SELECT * FROM registration r" +
" WHERE r.student = " + "'" + studentId + "'",
......@@ -195,8 +195,7 @@ public class Registration {
}
public static Object findRegistrationsPerAdvisor() {
// String professorId = PermissionProvider.getIdFromLoggedInProfessor();
String professorId="160";
String professorId = PermissionProvider.getIdFromLoggedInProfessor();
return entityManager().createNativeQuery(
"SELECT * FROM registration r where "+
" advisor = "+"'"+professorId+"'" , Registration.class).getResultList();
......
......@@ -17,6 +17,7 @@ import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.util.KerberosAuthProvider;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
......@@ -56,8 +57,7 @@ public class StudentGrant {
}
public static Object findGrantsPerKindAndPerAdvisor(String grant) {
// String professorId = PermissionProvider.getIdFromLoggedInProfessor();
String professorId="160";
String professorId = KerberosAuthProvider.getIdFromLoggedInProfessor();
return entityManager().createNativeQuery(
"SELECT * FROM student_grant a, grant_kind b, registration r"+
" WHERE a.end_date is null"+
......
......@@ -42,14 +42,15 @@ public class RegistrationController {
}
@RequestMapping(value="list",method = RequestMethod.GET)
public String list(@RequestParam(value = "year", required = false) String year,
@RequestParam(value = "kind", required = false) String kind,
@RequestParam(value = "status", required = false) String status,
Model model) {
public String list(
@RequestParam(value = "year", required = false) String year,
@RequestParam(value = "kind", required = false) String kind,
@RequestParam(value = "status", required = false) String status,
Model model) {
if (KerberosAuthProvider.getPersonAuth().equals(KerberosAuthProvider.authProfessor))
model.addAttribute("registrations", Registration.findRegistrations("160",year, kind, status));
// model.addAttribute("registrations", Registration.findRegistrations(PermissionProvider.getIdFromLoggedInProfessor(),year, kind, status));
model.addAttribute("registrations", Registration.findRegistrations(
KerberosAuthProvider.getIdFromLoggedInProfessor(),year, kind, status));
else
model.addAttribute("registrations", Registration.findRegistrations(year, kind, status));
......@@ -68,15 +69,14 @@ public class RegistrationController {
@RequestParam(value = "regStatus", required = false) String regStatus,
Model model) {
if (KerberosAuthProvider.getPersonAuth().equals(KerberosAuthProvider.authProfessor))
model.addAttribute("registrations",
Registration.findStudentsPerCourseYear("160", regKind, year,regStatus));
// Registration.findStudentsPerCourseYear(PermissionProvider.getIdFromLoggedInProfessor(), regKind, year,regStatus));
else
model.addAttribute("registrations",
Registration.findStudentsPerCourseYear(regKind, year,regStatus));
if (KerberosAuthProvider.getPersonAuth().equals(KerberosAuthProvider.authProfessor))
model.addAttribute("registrations",Registration.findStudentsPerCourseYear(
KerberosAuthProvider.getIdFromLoggedInProfessor(), regKind, year,regStatus));
else
model.addAttribute("registrations",
Registration.findStudentsPerCourseYear(regKind, year,regStatus));
return "registrations/liststudentssimple";
return "registrations/liststudentssimple";
}
@RequestMapping(value = "registrationsperadvisor", method = RequestMethod.GET)
......
log4j.rootLogger=info, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=application.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment