示例#1
0
    def GET(self, domain):
        if logman.LoggedIn() == True:
            if qv_domains.is_domain(domain):
                n_group = qv_domains.get_n_groups(domain)

                recs = usrman.get_usr_list()
                usrs = []
                for r in recs:
                    usrs.append(r["Username"])
                if qv_domains.Access_domain(
                        domain,
                        web.cookies().get('QV_Usr')) == "Coord":
                    return renderer.manage(
                        config.base_url,
                        domain,  # name of domain to manage (string)
                        True,  # is user logged in? (boolean)
                        logman.isAdmin(),  # is user and Admin? (boolean)
                        "Coord",  # Access that user has to domain (string)
                        qv_domains.get_list_of_editors(
                            domain
                        ),  # list of editors for domain (string[] / None)
                        None,  # list of coordinators for domain (string[] / None)
                        usrs,
                        n_group,
                        config.base_url + domain + '/view?magic=' +
                        qv_domains.get_admin_url(domain))
                if logman.isAdmin():
                    return renderer.manage(
                        config.base_url,
                        domain,  # name of domain to manage (string)
                        True,  # is user logged in? (boolean)
                        logman.isAdmin(),  # is user and Admin? (boolean)
                        None,  # Access that user has to domain (string)
                        qv_domains.get_list_of_users(
                            domain
                        ),  # list of users for domain (string[[]] / None)
                        None,  # list of coordinators for domain (string[] / None)
                        usrs,
                        n_group,
                        config.base_url + domain + '/view?magic=' +
                        qv_domains.get_admin_url(domain))
                if qv_domains.Access_domain(
                        domain,
                        web.cookies().get('QV_Usr')) == "Editor":
                    return renderer.manage(
                        config.base_url,
                        domain,  # name of domain to manage (string)
                        True,  # is user logged in? (boolean)
                        logman.isAdmin(),  # is user and Admin? (boolean)
                        "Editor",  # Access that user has to domain (string)
                        [""],  # list of editors for domain (string[] / None)
                        None,  # list of coordinators for domain (string[] / None)
                        usrs,
                        n_group)
            else:
                return web.notfound()
        return web.seeother('/login')
示例#2
0
    def GET(self, domain):

        # check logged in
        if not logman.LoggedIn():
            print "Failed Login!"
            return web.seeother('/login')

        # check for valid domain
        if not qv_domains.is_domain(domain):
            print "Failed domain check!"
            return web.notacceptable()

        # check that user has access to this domain
        attempt_at_access = qv_domains.Access_domain(
            domain,
            web.cookies().get('QV_Usr'))
        if logman.isAdmin(
        ) or attempt_at_access == "Coord" or attempt_at_access == "Editor":
            print "Authourized"
        else:
            print "Failed Access!"
            return web.notacceptable()

        qs = qv_questions.find({'domain': domain}).sort([('inserted_at', -1)])

        data = {
            'existing_questions': [],
            'new_uuid':
            uuid4(),
            'domain':
            domain,
            'active_question':
            qv_domains.get_active_question(domain),
            'submit_url':
            glob.urls['question_post']['url_pattern'] % (domain),
            'get_url':
            glob.urls['question_get']['url_pattern'] % (domain, ''),
            'get_results_url':
            glob.urls['results_get']['url_pattern'] % (domain, ''),
            'delete_url':
            glob.urls['answers_post']['url_pattern'] % (domain, ''),
            'results_url':
            glob.urls['view']['url_pattern'] % (domain),
            'history_url':
            glob.urls['history']['url_pattern'] % (domain),
        }

        qsd = [q for q in qs]

        data['existing_questions'] = qsd

        return renderer.editor(config.base_url, data, logman.LoggedIn())
示例#3
0
    def GET(self, domain):

		# check logged in
		if not logman.LoggedIn():
			print "Failed Login!"
			return web.seeother('/login')

		# check for valid domain
		if not qv_domains.is_domain(domain):
			print "Failed domain check!"
			return web.notacceptable()

		# check that user has access to this domain
		attempt_at_access = qv_domains.Access_domain(domain,web.cookies().get('QV_Usr'))
		if logman.isAdmin() or attempt_at_access == "Coord" or attempt_at_access == "Editor":
			print "Authourized"
		else:
			print "Failed Access!"
			return web.notacceptable()


		qs = qv_questions.find({'domain': domain}).sort([('inserted_at', -1)])

		data = {
            'existing_questions': [],
            'new_uuid': uuid4(),
            'domain': domain,
            'active_question': qv_domains.get_active_question(domain),
            'submit_url': glob.urls['question_post']['url_pattern']
            % (domain),
            'get_url': glob.urls['question_get']['url_pattern'] % (domain, ''),
            'get_results_url': glob.urls['results_get']['url_pattern']
            % (domain, ''),
            'delete_url': glob.urls['answers_post']['url_pattern'] % (domain, ''),
            'results_url': glob.urls['view']['url_pattern'] % (domain),
            'history_url': glob.urls['history']['url_pattern'] % (domain),
        }

		qsd = [q for q in qs]

		data['existing_questions'] = qsd

		return renderer.editor(config.base_url,data,logman.LoggedIn())
示例#4
0
	def DomainLogin(self,domain):
		# check logged in
		if not logman.LoggedIn():
			print "Failed Login!"
			return False

		# check for valid domain
		if not qv_domains.is_domain(domain):
			print "Failed domain check!"
			return False

		# check that user has access to this domain
		attempt_at_access = qv_domains.Access_domain(domain,web.cookies().get('QV_Usr'))
		if  logman.isAdmin() or attempt_at_access == "Coord" or attempt_at_access == "Editor":
			print "Authourized"
			return True
		else:
			print "Failed Access!"
			return False
示例#5
0
	def GET(self,domain):
		if logman.LoggedIn() == True:
			if qv_domains.is_domain(domain):
				recs = usrman.get_usr_list()
				usrs = []
				for r in recs:
					usrs.append(r["Username"])
				if qv_domains.Access_domain(domain,web.cookies().get('QV_Usr')) == "Coord":
					return renderer.manage(config.base_url,
						domain, 														# name of domain to manage (string)
						True,															# is user logged in? (boolean)
						logman.isAdmin(),												# is user and Admin? (boolean)
						"Coord",														# Access that user has to domain (string)
						qv_domains.get_list_of_editors(domain),							# list of editors for domain (string[] / None)
						None,															# list of coordinators for domain (string[] / None)
						usrs
					)
				if logman.isAdmin():
					return renderer.manage(config.base_url,
						domain, 														# name of domain to manage (string)
						True,															# is user logged in? (boolean)
						logman.isAdmin(),												# is user and Admin? (boolean)
						None,															# Access that user has to domain (string)
						qv_domains.get_list_of_users(domain),							# list of users for domain (string[[]] / None)
						None,															# list of coordinators for domain (string[] / None)
						usrs
					)
				if qv_domains.Access_domain(domain,web.cookies().get('QV_Usr')) == "Editor":
					return renderer.manage(config.base_url,
						domain, 														# name of domain to manage (string)
						True,															# is user logged in? (boolean)
						logman.isAdmin(),												# is user and Admin? (boolean)
						"Editor",														# Access that user has to domain (string)
						[""],															# list of editors for domain (string[] / None)
						None,															# list of coordinators for domain (string[] / None)
						usrs
					)
			else:
				return web.notfound()
		return web.seeother('/login')
示例#6
0
    def DomainLogin(self, domain):
        # check logged in
        if not logman.LoggedIn():
            print "Failed Login!"
            return False

        # check for valid domain
        if not qv_domains.is_domain(domain):
            print "Failed domain check!"
            return False

        # check that user has access to this domain
        attempt_at_access = qv_domains.Access_domain(
            domain,
            web.cookies().get('QV_Usr'))
        if logman.isAdmin(
        ) or attempt_at_access == "Coord" or attempt_at_access == "Editor":
            print "Authourized"
            return True
        else:
            print "Failed Access!"
            return False