-
Notifications
You must be signed in to change notification settings - Fork 14
Student admin #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Student admin #1063
Changes from 6 commits
064415d
378f998
7d19f29
bd4bf0b
8600142
148cbfb
86b43a3
ec5bf44
d81bc7c
1d505db
227866a
0bd4a63
2f401f8
7554fb3
2d08374
ffcf2c9
379e7ae
c9cbad0
8ff3aa9
293bd19
60c7431
ad4fca6
4b9c752
d1a2433
740f6b8
d5a2f74
a340704
bd4d1fd
c54bf3b
e50ca71
7d90425
cc64881
9bf62ff
5edb6cd
329d1d3
419d2a3
1e44a8c
807d724
4600233
86efbc6
1415951
44d1927
6381d44
f560f80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,13 +40,12 @@ def switchUser(): | |
|
|
||
| print(f"Switching user from {g.current_user} to",request.form['newuser']) | ||
| session['current_user'] = model_to_dict(User.get_by_id(request.form['newuser'])) | ||
|
|
||
| return redirect(request.referrer) | ||
|
|
||
|
|
||
| @admin_bp.route('/eventTemplates') | ||
| def templateSelect(): | ||
| if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentStaff: | ||
| if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentStaff or g.current_user.isCeltsStudentAdmin : | ||
| allprograms = getAllowedPrograms(g.current_user) | ||
| visibleTemplates = getAllowedTemplates(g.current_user) | ||
| return render_template("/events/template_selector.html", | ||
|
|
@@ -59,7 +58,7 @@ def templateSelect(): | |
|
|
||
| @admin_bp.route('/eventTemplates/<templateid>/<programid>/create', methods=['GET','POST']) | ||
| def createEvent(templateid, programid): | ||
| if not (g.current_user.isAdmin or g.current_user.isProgramManagerFor(programid)): | ||
| if not (g.current_user.isAdmin or g.current_user.isCeltsStudentAdmin or g.current_user.isProgramManagerFor(programid)): | ||
|
ojmakinde marked this conversation as resolved.
Outdated
|
||
| abort(403) | ||
|
|
||
| # Validate given URL | ||
|
|
@@ -144,7 +143,7 @@ def rsvpLogDisplay(eventId): | |
| eventData = model_to_dict(event, recurse=False) | ||
| eventData['program'] = event.program | ||
| isProgramManager = g.current_user.isProgramManagerFor(eventData['program']) | ||
| if g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager): | ||
| if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager): | ||
|
ojmakinde marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need the |
||
| allLogs = EventRsvpLog.select(EventRsvpLog, User).join(User).where(EventRsvpLog.event_id == eventId).order_by(EventRsvpLog.createdOn.desc()) | ||
| return render_template("/events/rsvpLog.html", | ||
| event = event, | ||
|
|
@@ -169,7 +168,7 @@ def eventDisplay(eventId): | |
| print(f"Unknown event: {eventId}") | ||
| abort(404) | ||
|
|
||
| notPermitted = not (g.current_user.isCeltsAdmin or g.current_user.isProgramManagerForEvent(event)) | ||
| notPermitted = not (g.current_user.isCeltsAdmin or g.current_user.isProgramManagerForEvent(event) or g.current_user.isCeltsStudentAdmin) | ||
|
ojmakinde marked this conversation as resolved.
Outdated
|
||
| if 'edit' in request.url_rule.rule and notPermitted: | ||
| abort(403) | ||
|
|
||
|
|
@@ -268,7 +267,7 @@ def eventDisplay(eventId): | |
|
|
||
| @admin_bp.route('/event/<eventId>/cancel', methods=['POST']) | ||
| def cancelRoute(eventId): | ||
| if g.current_user.isAdmin: | ||
| if g.current_user.isAdmin or g.current_user.isCeltsStudentAdmin: | ||
|
ojmakinde marked this conversation as resolved.
Outdated
|
||
| try: | ||
| cancelEvent(eventId) | ||
| return redirect(request.referrer) | ||
|
|
@@ -330,7 +329,7 @@ def userProfile(): | |
|
|
||
| @admin_bp.route('/search_student', methods=['GET']) | ||
| def studentSearchPage(): | ||
| if g.current_user.isAdmin: | ||
| if g.current_user.isAdmin or g.current_user.isCeltsStudentAdmin: | ||
| return render_template("/admin/searchStudentPage.html") | ||
| abort(403) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ def manageVolunteersPage(eventID): | |
|
|
||
| isProgramManager = g.current_user.isProgramManagerForEvent(event) | ||
| bannedUsers = [row.user for row in getBannedUsers(event.program)] | ||
| if not (g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager)): | ||
| if not (g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager)): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. the |
||
| abort(403) | ||
|
|
||
| eventParticipantData = list(EventParticipant.select(EventParticipant, User).join(User).where(EventParticipant.event==event)) | ||
|
|
@@ -108,7 +108,7 @@ def volunteerDetailsPage(eventID): | |
| print(f"No event found for {eventID}", e) | ||
| abort(404) | ||
|
|
||
| if not (g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and g.current_user.isProgramManagerForEvent(event))): | ||
| if not (g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentAdmin or (g.current_user.isCeltsStudentStaff and g.current_user.isProgramManagerForEvent(event))): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And again here |
||
| abort(403) | ||
|
|
||
| eventRsvpData = list(EventRsvp.select().where(EventRsvp.event==event)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,15 +18,15 @@ | |
| </a> | ||
| </li> | ||
|
|
||
| {% if g.current_user.isFaculty and not g.current_user.isAdmin%} | ||
| {% if g.current_user.isFaculty and not g.current_user.isAdmin and not g.current_user.isCeltsStudentAdmin %} | ||
| <li> | ||
| <a href="/serviceLearning/courseManagement" class="nav-link text-white {{'active' if request.path =='/serviceLearning/courseManagement'}}" {{"aria-current='page'" if request.path =='/serviceLearning/courseManagement'}}> | ||
| Course Proposals | ||
| </a> | ||
| </li> | ||
| {% endif %} | ||
|
|
||
| {% if g.current_user.isAdmin %} | ||
| {% if g.current_user.isAdmin or g.current_user.isCeltsStudentAdmin %} | ||
| <li> | ||
| <a href="/eventTemplates" class="nav-link text-white {{'active' if 'eventTemplates' in request.path}}" {{"aria-current='page'" if 'eventTemplates' in request.path}}> | ||
| Create Event | ||
|
|
@@ -38,7 +38,7 @@ | |
| </a> | ||
| </li> | ||
| <li> | ||
| {% if not g.current_user.isCeltsStudentStaff %} | ||
| {% if not g.current_user.isCeltsStudentStaff and not g.current_user.isCeltsStudentAdmin %} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is equivalent to |
||
| <a href="/serviceLearning/courseManagement" class="nav-link text-white {{'active' if request.path =='/serviceLearning/courseManagement'}}" {{"aria-current='page'" if request.path =='/serviceLearning/courseManagement'}}> | ||
| Course Proposals | ||
| </a> | ||
|
|
@@ -82,6 +82,7 @@ <h6>Current User: {{g.current_user.username}}</h6> | |
| <select name="newuser" class="form-select" style="margin-bottom: 10px" onchange="this.form.submit()">> | ||
| <option {{"selected" if g.current_user.username == config.default_user }} value="{{config.default_user}}">Default User: {{config.default_user}}</option> | ||
| <option {{"selected" if g.current_user.username == "ramsayb2"}} value="ramsayb2">Admin: ramsayb2</option> | ||
| <option {{"selected" if g.current_user.username == "bledsoef"}} value="bledsoef">Student Admin: bledsoef</option> | ||
| <option {{"selected" if g.current_user.username == "neillz"}} value="neillz">Student Staff: neillz</option> | ||
| <option {{"selected" if g.current_user.username == "ayisie"}} value="ayisie">Student: ayisie</option> | ||
| <option {{"selected" if g.current_user.username == "heggens"}} value="heggens">Faculty: heggens</option> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.