Skip to content

Commit ee7dbe0

Browse files
authored
Merge pull request #421 from ComputerScienceHouse/revert-418-develop
Revert "Merge dev into main"
2 parents bc8b71c + 9c353f9 commit ee7dbe0

25 files changed

+301
-434
lines changed

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
python-version: [3.12]
18+
python-version: [3.8, 3.9]
1919

2020
steps:
2121
- name: Install ldap dependencies

.pylintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ disable =
99
duplicate-code,
1010
no-member,
1111
parse-error,
12+
bad-continuation,
1213
too-few-public-methods,
1314
global-statement,
1415
cyclic-import,
@@ -17,11 +18,14 @@ disable =
1718

1819
[REPORTS]
1920
output-format = text
21+
files-output = no
2022
reports = no
2123

2224
[FORMAT]
2325
max-line-length = 120
26+
max-statement-lines = 75
2427
single-line-if-stmt = no
28+
no-space-check = trailing-comma,dict-separator
2529
max-module-lines = 1000
2630
indent-string = ' '
2731

@@ -69,6 +73,8 @@ good-names=logger,id,ID
6973
# Bad variable names which should always be refused, separated by a comma
7074
bad-names=foo,bar,baz,toto,tutu,tata
7175

76+
# List of builtins function names that should not be used, separated by a comma
77+
bad-functions=apply,input
7278

7379

7480
[DESIGN]
@@ -84,4 +90,4 @@ min-public-methods = 2
8490
max-public-methods = 20
8591

8692
[EXCEPTIONS]
87-
overgeneral-exceptions = builtins.Exception
93+
overgeneral-exceptions = Exception

Dockerfile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM docker.io/python:3.12-bookworm
2-
MAINTAINER Computer Science House <webmaster@csh.rit.edu>
1+
FROM docker.io/python:3.8-buster
2+
MAINTAINER Devin Matte <matted@csh.rit.edu>
33

44
RUN mkdir /opt/conditional
55

@@ -8,23 +8,19 @@ ADD requirements.txt /opt/conditional
88
WORKDIR /opt/conditional
99

1010
RUN apt-get -yq update && \
11-
apt-get -yq install libsasl2-dev libldap2-dev libldap-common libssl-dev gcc g++ make && \
11+
apt-get -yq install libsasl2-dev libldap2-dev libssl-dev gcc g++ make && \
1212
pip install -r requirements.txt && \
1313
apt-get -yq clean all
1414

15-
ENV NVM_DIR /usr/local/nvm
16-
ENV NODE_VERSION v10.24.1
17-
RUN mkdir -p $NVM_DIR
18-
19-
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
20-
21-
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION"
22-
2315
ADD . /opt/conditional
2416

25-
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm use --delete-prefix $NODE_VERSION && npm install && npm run production"
26-
27-
RUN rm -rf node_modules && \
17+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
18+
apt-get -yq update && \
19+
apt-get -yq install nodejs && \
20+
npm install && \
21+
npm run production && \
22+
rm -rf node_modules && \
23+
apt-get -yq remove nodejs npm && \
2824
apt-get -yq clean all
2925

3026
RUN ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

conditional/__init__.py

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
import structlog
55
from csh_ldap import CSHLDAP
6-
from flask import Flask, redirect, render_template, request, g
6+
from flask import Flask, redirect, render_template, g
77
from flask_migrate import Migrate
88
from flask_gzip import Gzip
99
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
10-
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
1110
from flask_sqlalchemy import SQLAlchemy
1211

1312
import sentry_sdk
@@ -40,10 +39,8 @@
4039
app.config['LDAP_BIND_PW'],
4140
ro=app.config['LDAP_RO'])
4241

43-
client_metadata = ClientMetadata(app.config["OIDC_CLIENT_CONFIG"])
44-
provider_config = ProviderConfiguration(issuer=app.config["OIDC_ISSUER"], client_registration_info=client_metadata)
45-
46-
auth = OIDCAuthentication({'default': provider_config}, app)
42+
auth = OIDCAuthentication(app, issuer=app.config["OIDC_ISSUER"],
43+
client_registration_info=app.config["OIDC_CLIENT_CONFIG"])
4744

4845
app.secret_key = app.config["SECRET_KEY"]
4946

@@ -58,6 +55,7 @@ def start_of_year():
5855
# pylint: disable=C0413
5956
from .models.models import UserLog
6057

58+
6159
# Configure Logging
6260
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
6361
if 'request' in event_dict:
@@ -101,7 +99,6 @@ def database_processor(logger, log_method, event_dict): # pylint: disable=unuse
10199
# pylint: disable=wrong-import-order
102100
from conditional.util import context_processors
103101
from conditional.util.auth import get_user
104-
from conditional.util.member import gatekeep_status
105102
from .blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports
106103
from .blueprints.attendance import attendance_bp
107104
from .blueprints.major_project_submission import major_project_bp
@@ -140,7 +137,7 @@ def static_proxy(path):
140137

141138

142139
@app.route('/')
143-
@auth.oidc_auth("default")
140+
@auth.oidc_auth
144141
def default_route():
145142
return redirect('/dashboard')
146143

@@ -159,25 +156,12 @@ def health():
159156
return {'status': 'ok'}
160157

161158

162-
@app.route("/gatekeep/<username>")
163-
def gatekeep(username):
164-
token = request.headers.get("X-VOTE-TOKEN", "")
165-
if token != app.config["VOTE_TOKEN"]:
166-
return "Users cannot access this page", 403
167-
try:
168-
gatekeep_data = gatekeep_status(username)
169-
except KeyError:
170-
return "", 404
171-
172-
return gatekeep_data, 200
173-
174-
175159
@app.errorhandler(404)
176160
@app.errorhandler(500)
177-
@auth.oidc_auth("default")
161+
@auth.oidc_auth
178162
@get_user
179163
def route_errors(error, user_dict=None):
180-
data = {}
164+
data = dict()
181165

182166
# Handle the case where the header isn't present
183167
if user_dict['username'] is not None:

0 commit comments

Comments
 (0)