Beispiel #1
0
    def get(self, request):
        terminalInstance = Terminal()
        id = request.session['userid']
        user = USER.objects.get(id=id)
        terminalInstance.login(user.username, user.password)
        ret, bool = terminalInstance.accessData()
        if (bool == False):
            render(request, 'shell/error.html')

        return render(request, 'shell/editContactInfo.html')
Beispiel #2
0
 def get(self, request):
     terminalInstance = Terminal()
     id = request.session['userid']
     user = USER.objects.get(id=id)
     terminalInstance.login(user.username, user.password)
     ret, bool = terminalInstance.accessData()
     if (bool == True):
         allCourses = ret[1]
         return render(request, 'shell/editCourse.html',
                       {"allCourses": allCourses})
     return render(request, 'shell/editCourse.html')
Beispiel #3
0
    def get(self, request):
        terminalInstance = Terminal()
        id = request.session['userid']
        user = USER.objects.get(id=id)
        terminalInstance.login(user.username, user.password)
        ret, bool = terminalInstance.accessData()
        if (bool == False):
            render(request, 'shell/error.html')

        allCourses = ret[1]
        return render(request, 'shell/createLab.html',
                      {'allCourses': allCourses})
Beispiel #4
0
    def get(self, request):
        terminalInstance = Terminal()
        id = request.session['userid']
        user = USER.objects.get(id=id)
        terminalInstance.login(user.username, user.password)
        ret, bool = terminalInstance.accessData()
        if (bool == False):
            render(request, 'shell/error.html')

        allUsers = ret[0]
        allCourses = ret[1]
        allLabs = ret[2]
        assistantAssignments = ret[3]
        instructorAssignments = ret[4]
        return render(
            request, 'shell/accessAllData.html', {
                "allUsers": allUsers,
                "allCourses": allCourses,
                "allLabs": allLabs,
                "assistantAssignments": assistantAssignments,
                "instructorAssignments": instructorAssignments
            })
Beispiel #5
0
    def get(self, request):
        terminalInstance = Terminal()
        id = request.session['userid']
        user = USER.objects.get(id=id)
        terminalInstance.login(user.username, user.password)
        ret, success = terminalInstance.accessData()
        if (success == False):
            render(request, 'shell/error.html')

        #allUsers=[]

        #for i in ret[0]:
        #    if i.permission.__contains__('3'):
        #        allUsers = allUsers + i

        allUsers = USER.objects.filter(permission='3')
        allCourses = ret[1]
        instructorAssignments = ret[4]
        return render(
            request, 'shell/assignInstructorToCourse.html', {
                'allUsers': allUsers,
                'allCourses': allCourses,
                'instructorAssignments': instructorAssignments
            })
 def test_accessData(self):
     userdata = USER.objects.get(username="******")
     user = User.User(userdata.permission, userdata.username,
                      userdata.password, userdata.id, userdata.email,
                      userdata.firstName, userdata.lastName,
                      userdata.contactPhone, userdata.officePhone,
                      userdata.extension)
     userdata2 = USER.objects.get(username="******")
     user2 = User.User(userdata2.permission, userdata2.username,
                       userdata2.password, userdata2.id, userdata2.email,
                       userdata2.firstName, userdata2.lastName,
                       userdata2.contactPhone, userdata2.officePhone,
                       userdata2.extension)
     userdata3 = USER.objects.get(username="******")
     user3 = User.User(userdata3.permission, userdata3.username,
                       userdata3.password, userdata3.id, userdata3.email,
                       userdata3.firstName, userdata3.lastName,
                       userdata3.contactPhone, userdata3.officePhone,
                       userdata3.extension)
     userdata4 = USER.objects.get(username="******")
     user4 = User.User(userdata4.permission, userdata4.username,
                       userdata4.password, userdata4.id, userdata4.email,
                       userdata4.firstName, userdata4.lastName,
                       userdata4.contactPhone, userdata4.officePhone,
                       userdata4.extension)
     courseData = COURSE.objects.get(courseNumber=500)
     course = Course.Course(courseData.id, courseData.name,
                            courseData.courseNumber, courseData.classNumber,
                            courseData.time, courseData.location)
     print(user.permission[1])
     self.assertTrue(user.permission[1] == '1')
     self.assertTrue(user2.permission[1] == '2')
     self.assertTrue(user3.permission[1] != '1')
     self.assertTrue(user3.permission[1] != '2')
     self.assertTrue(user4.permission[1] != '1',
                     "Not Authorized To Use This Command")
     self.assertTrue(user4.permission[1] != '2',
                     "Not Authorized To Use This Command")
     self.user = user
     self.assertEqual(
         Terminal.accessData(self),
         str(user.permission) + " " + user.username + " " + user.password +
         " " + str(user.databaseID) + " " + user.email + " " +
         user.firstName + " " + user.lastName + " " + user.contactPhone +
         " " + user.officePhone + " " + user.extension + "\n " +
         str(user2.permission) + " " + user2.username + " " +
         user2.password + " " + str(user2.databaseID) + " " + user2.email +
         " " + user2.firstName + " " + user2.lastName + " " +
         user2.contactPhone + " " + user2.officePhone + " " +
         user2.extension + "\n " + str(user3.permission) + " " +
         user3.username + " " + user3.password + " " +
         str(user3.databaseID) + " " + user3.email + " " + user3.firstName +
         " " + user3.lastName + " " + user3.contactPhone + " " +
         user3.officePhone + " " + user3.extension + "\n " +
         str(user4.permission) + " " + user4.username + " " +
         user4.password + " " + str(user4.databaseID) + " " + user4.email +
         " " + user4.firstName + " " + user4.lastName + " " +
         user4.contactPhone + " " + user4.officePhone + " " +
         user4.extension + "\n " + str(course.databaseID) + " " +
         course.name + " " + str(course.courseNumber) + " " +
         str(course.classNumber) + " " + str(course.labList) + " " +
         course.time + " " + course.location)