Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ DATA/*
*.log
httpd2.pid
httpd.pid
lib/WebworkBridge/classlists/
.dump_past_answers_salt
.data
.idea
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ RUN apt-get update \
libmoox-options-perl \
libnet-https-nb-perl \
libhttp-async-perl \
libtheschwartz-perl \
libcrypt-jwt-perl \
libjson-validator-perl \
make \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-prod
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ RUN apt-get update \
libmoox-options-perl \
libnet-https-nb-perl \
libhttp-async-perl \
libtheschwartz-perl \
libcrypt-jwt-perl \
libjson-validator-perl \
libmoose-perl \
Expand Down
1 change: 1 addition & 0 deletions bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
XML::Simple
App::Genpass
HTTP::Async
TheSchwartz
Crypt::JWT
JSON::Validator
);
Expand Down
118 changes: 85 additions & 33 deletions conf/database.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -119,36 +119,6 @@ $dbLayouts{sql_single} = {
non_native => 1,
},
},
lti_contexts => {
record => "WeBWorK::DB::Record::LTIContexts",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
lti_nonces => {
record => "WeBWorK::DB::Record::LTINonces",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
lti_access_tokens => {
record => "WeBWorK::DB::Record::LTIAccessTokens",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
password => {
record => "WeBWorK::DB::Record::Password",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
Expand Down Expand Up @@ -395,8 +365,9 @@ $dbLayouts{sql_single} = {
tableOverride => "${courseName}_global_user_achievement"
},
},
# LTI Advantage
lti_resource_link => {
record => "WeBWorK::DB::Record::LTIResourceLink",
record => "WeBWorK::DB::Record::LTIAdvantage::ResourceLink",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
Expand All @@ -406,15 +377,96 @@ $dbLayouts{sql_single} = {
},
},
lti_user => {
record => "WeBWorK::DB::Record::LTIUser",
record => "WeBWorK::DB::Record::LTIAdvantage::User",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
tableOverride => "${courseName}_lti_user"
},
}
},
lti_contexts => {
record => "WeBWorK::DB::Record::LTIAdvantage::Contexts",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
lti_nonces => {
record => "WeBWorK::DB::Record::LTIAdvantage::Nonces",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
lti_access_tokens => {
record => "WeBWorK::DB::Record::LTIAdvantage::AccessTokens",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
# Delayed Job Tables
funcmap => {
record => "WeBWorK::DB::Record::DelayedJob::Funcmap",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
job => {
record => "WeBWorK::DB::Record::DelayedJob::Job",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
note => {
record => "WeBWorK::DB::Record::DelayedJob::Note",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
error => {
record => "WeBWorK::DB::Record::DelayedJob::Error",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
},
exitstatus => {
record => "WeBWorK::DB::Record::DelayedJob::Exitstatus",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
engine => $database_storage_engine,
params => { %sqlParams,
non_native => 1,
},
}
};

# include ("conf/database.conf"); # uncomment to provide local overrides
Expand Down
17 changes: 17 additions & 0 deletions conf/defaults.config
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,23 @@ $ConfigValues = [
},

],
['LTI',
{ var => 'lti_advantage{auto_assign_users_to_sets}',
doc => 'Automatically assign users to sets',
doc2 => 'By default, users are automatically assigned to all sets when they launch into WeBWorK from the LMS or when the class roster is synced.',
type => 'boolean'
},
{ var => 'lti_advantage{cron_grade_sync}',
doc => 'Automatically send student grades to LMS via cron job',
doc2 => 'By default, student grades are automatically sent to the LRS via a cron job.',
type => 'boolean'
},
{ var => 'lti_advantage{cron_roster_sync}',
doc => 'Automatically get roster from LMS via cron job',
doc2 => 'By default, class roster is automatically fetched from the LMS via a cron job.',
type => 'boolean'
},
],
# PGSimple is not used for now GG
# ['Editor',
# { var => 'editor{author}',
Expand Down
45 changes: 20 additions & 25 deletions conf/localOverrides.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,19 @@ $webworkURLs{bugReporter} = "mailto:webwork.support\@ubc.ca";

# Add in custom authen modules
$authen{lti} = "WeBWorK::Authen::LTIAdvantage";
$authen{vista_login} = "WeBWorK::Authen::VistaLogin2";
# xmlrpc webservice requests will use the default auth instead of shib
$authen{'xmlrpc'} = "WeBWorK::Authen";

################################################################################

################################################################################
# Delayed Job
################################################################################

$delayed_job{enabled} = 1;

################################################################################
# Webwork Caliper
# Caliper
################################################################################

# enable/disable Caliper for install
Expand Down Expand Up @@ -630,20 +634,17 @@ $caliper{custom_actor_generator} = sub {


################################################################################
# Webwork Bridge
# LTI Advantage
################################################################################
$bridge{studentlog} = $webworkDirs{logs} . "/studentupdates.log";
$lti_advantage{studentlog} = $webworkDirs{logs} . "/studentupdates.log";
# Set password for the admin user created for all imported courses.
$bridge{adminuserpw} = "admin";
$bridge{push_grades_on_submit} = 0;
$bridge{hide_new_courses} = 1;
# define which LTI roles will launch the membership request on launch.
$bridge{roles_can_update} = [
"http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor",
"http://purl.imsglobal.org/vocab/lis/v2/membership#ContentDeveloper",
"http://purl.imsglobal.org/vocab/lis/v2/membership#Administrator"
];
$bridge{lti_clients} = {
$lti_advantage{adminuserpw} = "admin";
$lti_advantage{push_grades_on_submit} = 1;
$lti_advantage{hide_new_courses} = 1;
$lti_advantage{auto_assign_users_to_sets} = 1;
$lti_advantage{cron_grade_sync} = 1;
$lti_advantage{cron_roster_sync} = 1;
$lti_advantage{lti_clients} = {
'example_client_id' => {
# will look inside of nested object if `|` is used as seperator. Doing this allow using fields inside of claims
# set to $Canvas.user.sisIntegrationId in canvas
Expand All @@ -660,7 +661,7 @@ $bridge{lti_clients} = {
}
};

$bridge{lti_clients}{'example_client_id'}{tool_public_key} = <<'EOF';
$lti_advantage{lti_clients}{'example_client_id'}{tool_public_key} = <<'EOF';
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6sJx68cYViPEty86G2KB
nWh62Aoc99zguv69ni4y+augier+1IArQ5apF8j657zbk/EYUf3kRka1fGmALvQY
Expand All @@ -670,7 +671,7 @@ lQIDAQAB
-----END PUBLIC KEY-----
EOF

$bridge{lti_clients}{'example_client_id'}{tool_private_key} = <<'EOF';
$lti_advantage{lti_clients}{'example_client_id'}{tool_private_key} = <<'EOF';
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA6sJx68cYViPEty86G2KBnWh62Aoc99zguv69ni4y+augier+
1IArQ5apF8j657zbk/EYUf3kRka1fGmALvQYZ+MWjjomR64u7rofgdetgnfIOQQa
Expand All @@ -682,18 +683,12 @@ wqw0N02hAoGAbpjOnPTul04AerLoehExqsBxTw255n/k70kWizKITmuPKFLwECKV
-----END RSA PRIVATE KEY-----
EOF

# List of Vista ids that are blacklisted from import. Note that id matching
# is done using m//, so any occurance of the string below in an id will mark
# that id as blacklisted.
$bridge{vista_blacklist} = (
"webct_demo"
);
# Note that the mapped Webwork course name still goes through sanitization.
# Please make sure they match these requirements or the courses will not match.
# - Allowed characters in regex form: [a-zA-Z0-9_-]
# - Max length 40 characters
# See WeBWorK::Authen::LTIAdvantage::LTILaunchParser() for implementation
$bridge{custom_course_title_parser} = sub {
# See LTIAdvantage::Parser::LaunchParser() for implementation
$lti_advantage{custom_course_title_parser} = sub {
my $parser = shift;

# else use term name (if available) and context_label
Expand All @@ -707,7 +702,7 @@ $bridge{custom_course_title_parser} = sub {
return $course_title;
};

$bridge{course_template} = "modelCourse";
$lti_advantage{course_template} = "modelCourse";

$shibboleth{login_script} = "/Shibboleth.sso/Login";
$shibboleth{logout_script} = "/Shibboleth.sso/Logout?return=".$server_root_url.$webwork_url;
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
MYSQL_USER: ${WEBWORK_DB_USER}
MYSQL_PASSWORD: ${WEBWORK_DB_PASSWORD}

app:
app: &app
image: webwork

# Select the appropriate "build:" block:
Expand Down Expand Up @@ -185,6 +185,11 @@ services:
# WEBWORK_TIMEZONE: America/New_York
# R_HOST: r

worker:
<<: *app
command: ./webwork2/lib/DelayedJob/Run/run_all_jobs.pl
ports: []

r:
image: ubcctlt/rserve
# # The R server need not be available from outside the local Docker network.
Expand Down
14 changes: 13 additions & 1 deletion lib/Caliper/Sensor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use HTTP::Async;
use Caliper::Event;
use Caliper::ResourceIri;

#$WeBWorK::Debug::Enabled = 1;

# Constructor
sub new
Expand Down Expand Up @@ -54,7 +55,18 @@ sub sendEvents
Caliper::Event::add_defaults($r, $event_hash);
}

my $ce = $r->{ce};
if ($self->{ce}->{delayed_job}{enabled}) {
my $delayed_job_service = DelayedJob::Service->new($self->{ce});
$delayed_job_service->sendEvents($array_of_events);
} else {
$self->_sendEvents($array_of_events);
}
}
sub _sendEvents
{
my ($self, $array_of_events) = @_;

my $ce = $self->{ce};
my $resource_iri = Caliper::ResourseIri->new($ce);
my $async = HTTP::Async->new;
$async->timeout( 5 );
Expand Down
Loading