def get(self, request): query = request.GET user = request.user providers = [] records = CoreMaintenanceRecord.objects.none() active_records = query.get('active', 'false').lower() == "true" if user and type(user) != AnonymousUser: groups = user.group_set.all() for group in groups: provider_ids = group.identities.filter( only_current_provider(), provider__active=True).values_list('provider', flat=True) providers = Provider.objects.filter(id__in=provider_ids) for p in providers: if active_records: records |= CoreMaintenanceRecord.active(p) else: records |= CoreMaintenanceRecord.objects.filter( provider=p) if active_records: global_records = CoreMaintenanceRecord.active() else: global_records = CoreMaintenanceRecord.objects.filter( provider=None) records |= global_records return Response(MaintenanceRecordSerializer(records, many=True).data)
def get(self, request): """ """ user = request.user groups = user.group_set.all() providers = [] records = CoreMaintenanceRecord.objects.none() for g in groups: for p in g.providers.all(): if p not in providers: providers.append(p) if 'active' in request.GET: if request.GET['active'].lower() == "true": now_time = timezone.now() for p in providers: records |= CoreMaintenanceRecord.active(p) else: all_records = CoreMaintenanceRecord.objects.all() now_time = timezone.now() for p in providers: records |= CoreMaintenanceRecord.active(p) records = all_records.exclude(id__in=records) else: records = CoreMaintenanceRecord.objects.filter( Q(provider__in=providers) | Q(provider=None)) return Response(MaintenanceRecordSerializer(records, many=True).data)
def login(request): """ CAS Login : Phase 1/3 Call CAS Login """ #logger.info("Login Request:%s" % request) #Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True if 'next' in request.POST: return auth_loginRedirect(request, settings.REDIRECT_URL + '/application/') else: template = get_template('application/login.html') variables = RequestContext( request, { 'site_root': settings.REDIRECT_URL, 'records': [r.json() for r in records], 'disable_login': disable_login }) output = template.render(variables) return HttpResponse(output)
def login(request): """ CAS Login : Phase 1/3 Call CAS Login """ # logger.info("Login Request:%s" % request) # Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True if "next" in request.POST: return cas_loginRedirect(request, settings.REDIRECT_URL + "/application/") else: template = get_template("application/login.html") variables = RequestContext( request, { "site_root": settings.REDIRECT_URL, "records": [r.json() for r in records], "disable_login": disable_login, }, ) output = template.render(variables) return HttpResponse(output)
def s_login(request): """ SAML Login: Phase 1/2 Call SAML Login """ # Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True return saml_loginRedirect(request)
def s_login(request): """ SAML Login: Phase 1/2 Call SAML Login """ #logger.info("Login Request:%s" % request) #Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True return saml_loginRedirect(request)
def s_login(request): """ SAML Login: Phase 1/2 Call SAML Login """ #logger.info("Login Request:%s" % request) #Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True return saml_loginRedirect(request, settings.REDIRECT_URL+"/login/")
def get(self, request): query = request.GET user = request.user providers = [] records = CoreMaintenanceRecord.objects.none() active_records = query.get('active', 'false').lower() == "true" if user and not isinstance(user, AnonymousUser): groups = user.group_set.all() for group in groups: providers = group.current_providers.all() for p in providers: if active_records: records |= CoreMaintenanceRecord.active(p) else: records |= CoreMaintenanceRecord.objects.filter( provider=p) if active_records: global_records = CoreMaintenanceRecord.active() else: global_records = CoreMaintenanceRecord.objects.filter( provider=None) records |= global_records return Response(MaintenanceRecordSerializer(records, many=True).data)
def get(self, request): query = request.GET user = request.user providers = [] records = CoreMaintenanceRecord.objects.none() active_records = query.get('active', 'false').lower() == "true" if user and not isinstance(user, AnonymousUser): memberships = user.memberships.select_related('group') for membership in memberships: group = membership.group providers = group.current_providers.all() for p in providers: if active_records: records |= CoreMaintenanceRecord.active(p) else: records |= CoreMaintenanceRecord.objects.filter( provider=p) if active_records: global_records = CoreMaintenanceRecord.active() else: global_records = CoreMaintenanceRecord.objects.filter( provider=None) records |= global_records return Response(MaintenanceRecordSerializer(records, many=True).data)
def get(self, request): """ """ query = request.GET user = request.user providers = [] records = CoreMaintenanceRecord.objects.none() active_records = query.get('active', 'false').lower() == "true" if user and type(user) != AnonymousUser: groups = user.group_set.all() for g in groups: for p in g.providers.all(): if active_records: records |= CoreMaintenanceRecord.active(p) else: records |= CoreMaintenanceRecord.objects.filter( provider=p) if active_records: global_records = CoreMaintenanceRecord.active() else: global_records = CoreMaintenanceRecord.objects.filter( provider=None) records |= global_records return Response(MaintenanceRecordSerializer(records, many=True).data)
def login(request): """ CAS Login : Phase 1/3 Call CAS Login """ # Form Sets 'next' when user clicks login records = MaintenanceRecord.active() disable_login = False for record in records: if record.disable_login: disable_login = True if 'next' in request.POST: return auth_loginRedirect(request, settings.REDIRECT_URL + '/application/') else: template = get_template('application/login.html') variables = RequestContext(request, { 'site_root': settings.REDIRECT_URL, 'records': [r.json() for r in records], 'disable_login': disable_login}) output = template.render(variables) return HttpResponse(output)