Skip to content

Commit

Permalink
Added Admin settings for laptop configuration and json api endpoint o…
Browse files Browse the repository at this point in the history
…n top of verify_ope_account_in_smc
  • Loading branch information
frankyrumple committed Jan 5, 2024
1 parent 5189404 commit 27c948e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
4 changes: 3 additions & 1 deletion web2py/applications/smc/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def laptop_settings():

rows = db().select(db.my_app_settings.ALL)
form = SQLFORM(db.my_app_settings, rows[0], showid=False,
fields=["laptop_admin_user", "laptop_admin_password", "laptop_network_type"]).process()
fields=[
"laptop_admin_user", "laptop_admin_password", "laptop_network_type",
"laptop_domain_name", "laptop_domain_ou"]).process()

if form.accepted:
# Saved
Expand Down
11 changes: 10 additions & 1 deletion web2py/applications/smc/controllers/lms.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def verify_ope_account_in_smc():
user_name = None
laptop_admin_user = ""
laptop_admin_password = ""
laptop_network_type = ""
laptop_domain_name = ""
laptop_domain_ou = ""


# Get the student user in question
if len(request.args) > 0:
Expand All @@ -101,14 +105,19 @@ def verify_ope_account_in_smc():
if msg == "Found":
# Pull the laptop admin info
laptop_admin_user = AppSettings.GetValue("laptop_admin_user", "")
laptop_network_type = AppSettings.GetValue("laptop_network_type", "Standalone")
laptop_domain_name = AppSettings.GetValue("laptop_domain_name", "SBCTC.local")
laptop_domain_ou = AppSettings.GetValue("laptop_domain_ou", "laptopOU.SBCTC.local")
# Moved pw to credential area
laptop_admin_password = "********" # AppSettings.GetValue("laptop_admin_password", "")


smc_version = get_app_version()
return dict(msg=msg, student_full_name=student_full_name,
laptop_admin_user=laptop_admin_user,
laptop_admin_password=laptop_admin_password,
smc_version=smc_version)
smc_version=smc_version, laptop_network_type=laptop_network_type,
laptop_domain_name=laptop_domain_name, laptop_domain_ou=laptop_domain_ou)


# TODO - Setup permission and add facult/admins to credential permission
Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/models/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# (T(u'Configure App \u2bc8 ZFS Settings'), False, URL('admin', 'config_zfs_settings')),
(T(u'Configure App \u2bc8 Verify Settings'), False, URL('admin', 'config_verify')),
(T(u'Configure App \u2bc8 Verify Settings (auto create)'), False, URL('admin', 'config_verify_auto')),
(T(u'Configure App \u2bc8 Laptop Admin Credentials'), False, URL('admin', 'laptop_admin_credentials')),
#(T(u'Configure App \u2bc8 Laptop Admin Credentials'), False, URL('admin', 'laptop_admin_credentials')),
(T(u'Configure App \u2bc8 Add LTI Tools to Canvas'), False, URL('lti', 'add_lti_tools_to_canvas')),
(T(u'Configure App \u2bc8 Laptop Settings'), False, URL('admin', 'laptop_settings')),
# ]),
Expand Down
5 changes: 4 additions & 1 deletion web2py/applications/smc/models/x_app_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@
Field("disable_student_self_change_password", "boolean", default="False"),
Field("disable_faculty_self_change_password", "boolean", default="False"),
Field("disable_media_auto_play", "boolean", default="True"),
Field("laptop_network_type", "string", default="standalone", requires=IS_IN_SET(["standalone", "domain"])),
Field("laptop_network_type", "string", default="Standalone", requires=IS_IN_SET(["Standalone", "Domain Member"])),
Field("laptop_domain_name", "string", default="SBCTC.local", required=True),
Field("laptop_domain_ou", "string", default="laptopOU.SBCTC.local", required=True),


)
# force defaults for new fields to prevent nulls
Expand Down
6 changes: 4 additions & 2 deletions web2py/applications/smc/models/x_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
auth.add_permission(name='credential', group_id=auth.id_group(role='Faculty'))

# Make sure we set some defaults for new settings fields so we don't end up with nulls
db(db.my_app_settings.laptop_network_type == None).update(laptop_network_type="standalone")

db(db.my_app_settings.laptop_network_type == None).update(laptop_network_type="Standalone")
db(db.my_app_settings.laptop_domain_name == None).update(laptop_domain_name="SBCTC.local")
db(db.my_app_settings.laptop_domain_ou == None).update(laptop_domain_ou="laptopOU.SBCTC.local")


db.commit()

Expand Down
11 changes: 11 additions & 0 deletions web2py/applications/smc/views/admin/laptop_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ <h3>
<b>Laptop Admin Password: </b> The password to use for the admin account<br />
<strong style="color: #ff0000">(DO NOT USE YOUR DOMAIN ADMIN PASSWORD!!! CHOOSE AN ALTERNATE PASSWORD!!!)</strong>
</div>
<div>
<b>Laptop Network Type:</b> Choose standalone if using the laptops in a standalone very secure environment with no domain controller.
Use Domain Member if domain group policy should address most of the security settings.
</div>
<div>
<b>Laptop Domain Name:</b> The full domain name that the laptop should be joined to (ignored if using Standalone mode)- <strong style="color:#ff0000">laptop should be a member already before credentialing.</strong>
</div>
<div>
<b>Laptop Domain OU:</b> The path to the Organizational Unit this laptop should be in when joined to the domain (ignored if using Standalone mode).
</div>

</div>
</div>

0 comments on commit 27c948e

Please sign in to comment.