-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add api integration for offline LMS app and canvas
- Loading branch information
1 parent
95dd238
commit a0203ea
Showing
18 changed files
with
513 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ cache/ | |
errors/ | ||
private/ | ||
static/media/ | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
db = current.db | ||
db | ||
key = "canvas_secret" | ||
val = "123" | ||
items = {key: val} | ||
items | ||
db(db.my_app_settings).select() | ||
db(db.my_app_settings).update(**items) | ||
db.commit() | ||
quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import sys | ||
import os | ||
import subprocess | ||
|
||
from gluon import current | ||
|
||
import paramiko | ||
|
||
from ednet.ad import AD | ||
from ednet.canvas import Canvas | ||
from ednet.appsettings import AppSettings | ||
|
||
|
||
# Needed for remote connection? | ||
auth.settings.allow_basic_login = True | ||
#auth.settings.actions_disabled.append('login') | ||
#auth.settings.allow_basic_login_only = True | ||
#auth.settings.actions.login_url=URL('your_own_error_page') | ||
|
||
@auth.requires_membership("Administrators") | ||
def credential_student(): | ||
response.view = 'generic.json' | ||
db = current.db | ||
|
||
key = "" | ||
msg = "" | ||
hash = "" | ||
user_name = "" | ||
full_name = "" | ||
# Get the user in question | ||
if len(request.args) > 0: | ||
user_name = request.args[0] | ||
if user_name is not None: | ||
# First - does the user exist? | ||
user_exists = False | ||
rows = db(db.auth_user.username == user_name).select(db.auth_user.id) | ||
for row in rows: | ||
user_exists = True | ||
if user_exists is True: | ||
key, msg, hash, full_name = Canvas.EnsureStudentAccessToken(user_name) | ||
|
||
else: | ||
# User doesn't exit! | ||
msg = "Invalid User!" | ||
return dict(key=key, msg=msg, hash=hash, full_name=full_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.