Skip to content
Open
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
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ RUN apt-get update \
libgd-perl \
libhtml-scrubber-perl \
libhtml-template-perl \
libhttp-async-perl \
libio-compress-perl \
libiterator-perl \
libiterator-util-perl \
Expand All @@ -133,7 +132,6 @@ RUN apt-get update \
libnet-ip-perl \
libnet-ldap-perl \
libnet-oauth-perl \
libossp-uuid-perl \
libpadwalker-perl \
libpandoc-wrapper-perl \
libpath-class-perl \
Expand Down Expand Up @@ -231,18 +229,18 @@ COPY --from=base /opt/base/pg $APP_ROOT/pg
RUN echo "PATH=$PATH:$APP_ROOT/webwork2/bin" >> /root/.bashrc \
&& mkdir /run/webwork2 /etc/ssl/local \
&& cd $APP_ROOT/webwork2/ \
&& chown www-data DATA ../courses logs tmp /etc/ssl/local /run/webwork2 \
&& chmod -R u+w DATA ../courses logs tmp /run/webwork2 /etc/ssl/local \
&& chown www-data DATA ../courses logs tmp /etc/ssl/local /run/webwork2 \
&& chmod -R u+w DATA ../courses logs tmp /run/webwork2 /etc/ssl/local \
&& echo "en_US ISO-8859-1\nen_US.UTF-8 UTF-8" > /etc/locale.gen \
&& /usr/sbin/locale-gen \
&& echo "locales locales/default_environment_locale select en_US.UTF-8\ndebconf debconf/frontend select Noninteractive" > /tmp/preseed.txt \
&& debconf-set-selections /tmp/preseed.txt \
&& /usr/sbin/locale-gen \
&& echo "locales locales/default_environment_locale select en_US.UTF-8\ndebconf debconf/frontend select Noninteractive" > /tmp/preseed.txt \
&& debconf-set-selections /tmp/preseed.txt \
&& rm -f /etc/localtime /etc/timezone && echo "Etc/UTC" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata \
&& dpkg-reconfigure -f noninteractive tzdata \
&& cd $WEBWORK_ROOT/htdocs \
&& npm install \
&& npm install \
&& cd $PG_ROOT/htdocs \
&& npm install
&& npm install

# ==================================================================
# Phase 7 - Final setup and prepare docker-entrypoint.sh
Expand Down
2 changes: 0 additions & 2 deletions DockerfileStage1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ RUN apt-get update \
libgd-perl \
libhtml-scrubber-perl \
libhtml-template-perl \
libhttp-async-perl \
libio-compress-perl \
libiterator-perl \
libiterator-util-perl \
Expand All @@ -94,7 +93,6 @@ RUN apt-get update \
libnet-ip-perl \
libnet-ldap-perl \
libnet-oauth-perl \
libossp-uuid-perl \
libpadwalker-perl \
libpandoc-wrapper-perl \
libpath-class-perl \
Expand Down
11 changes: 0 additions & 11 deletions bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ =head1 DESCRIPTION
ubuntu => 'libdata-structure-util-perl'
}
},
'Data::UUID' => {
package => {
ubuntu => 'libossp-uuid-perl',
rhel => 'perl-Data-UUID'
}
},
'Date::Format' => {
package => {
ubuntu => 'libtimedate-perl',
Expand Down Expand Up @@ -283,11 +277,6 @@ =head1 DESCRIPTION
rhel => 'perl-HTML-Parser'
}
},
'HTTP::Async' => {
package => {
ubuntu => 'libhttp-async-perl'
}
},
'IO::File' => {
package => {
ubuntu => 'perl-base',
Expand Down
47 changes: 27 additions & 20 deletions conf/localOverrides.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -738,28 +738,35 @@ $mail{feedbackRecipients} = [
# Webwork Caliper
################################################################################

# enable/disable Caliper for install
#$caliper{enabled} = 0;
# base_url should ideally be hard coded to a persistent url pointing to the webwork root
# (important to keep it consistent over time)
#$caliper{base_url} = 'https://webwork.elearning.ubc.ca/webwork2/';
# LRS endpoint
#$caliper{host} = 'http://caliper.example.host.org/api/endpoint';
# Set this to 1 to enable Caliper. Note that the
# Mojolicious::WeBWorK::Plugin::Caliper plugin must also be enabled in
# conf/webwork2.mojolicous.yml in order for this to work, and all of the
# $caliper settings below must be uncommented and set except the
# $caliper{custom_actor_generator}. Note that this and all of the settings below
# can also be configured per course in the course.conf files.
$caliper{enabled} = 0;

# LRS endpoint to which the Caliper telemetry data will be sent.
#$caliper{host} = 'https://caliper.example.host.org/api/endpoint';

# LRS endpoint Bearer API key
#$caliper{api_key} = '1234567890abcdefg';
# log file for caliper errors
#$caliper{errorlog} = $webworkDirs{logs} . "/caliper_errors.log";
# customized Caliper actor. Useful if persistent identifiers for students are available in WebWork
# $caliper{custom_actor_generator} = sub {
# my ($ce, $db, $user) = @_;
# # set caliper id as needed
# my $caliper_id = 'http://www.ubc.ca/' . $user->user_id();
# return {
# 'id' => $caliper_id,
# 'type' => 'Person',
# 'name' => $user->first_name() . " " . $user->last_name(),
# };
# };

# Log file for caliper errors
#$caliper{errorlog} = "$webworkDirs{logs}/caliper_errors.log";

# Custom Caliper actor generator. This is useful if persistent identifiers for
# students are available in WebWork.
#$caliper{custom_actor_generator} = sub {
# my ($ce, $db, $user) = @_;
# # set caliper id as needed
# my $caliper_id = 'http://yourschool.edu/' . $user->user_id;
# return {
# id => $caliper_id,
# type => 'Person',
# name => $user->first_name . ' ' . $user->last_name,
# };
#};

###############################################################################
# Test settings
Expand Down
5 changes: 5 additions & 0 deletions conf/webwork2.mojolicious.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,8 @@ hardcopy:
# external websites with usernames and passwords embedded in them such as for
# PreTeXt textbooks.
allow_unsecured_rpc: 0

plugins:
# Uncomment the following to enable Caliper. Also set the Caliper settings in
# localOverrides.conf (or per course in course.conf files).
#- Mojolicious::WeBWorK::Plugin::Caliper: {}
43 changes: 11 additions & 32 deletions lib/Caliper/Actor.pm
Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
package Caliper::Actor;

##### Library Imports #####
use strict;
use warnings;
use WeBWorK::CourseEnvironment;
use WeBWorK::DB;
use Data::Dumper;
use Mojo::Base -signatures;

use Caliper::ResourceIri;

sub generate_anonymous_actor {
sub generate_default_actor ($c, $user) {
return {
'id' => 'http://purl.imsglobal.org/caliper/Person',
'type' => 'Person',
id => Caliper::ResourceIri->new($c->ce)->actor_homepage($user->user_id),
type => 'Person',
name => $user->first_name . ' ' . $user->last_name
};
}

sub generate_default_actor {
my ($ce, $db, $user) = @_;
my $resource_iri = Caliper::ResourceIri->new($ce);

return {
'id' => $resource_iri->actor_homepage($user->user_id()),
'type' => 'Person',
'name' => $user->first_name() . " " . $user->last_name(),
};
}
sub generate_actor ($c, $user_id) {
return { id => 'http://purl.imsglobal.org/caliper/Person', type => 'Person' } unless defined $user_id;

sub generate_actor {
my ($ce, $db, $user_id) = @_;
my $user = $c->db->getUser($user_id);

if (!defined($user_id)) {
return Caliper::Entity::generate_anonymous_actor();
} else {
my $user = $db->getUser($user_id);
return $c->ce->{caliper}{custom_actor_generator}($c->ce, $c->db, $user)
if ref $c->ce->{caliper}{custom_actor_generator} eq 'CODE';

if (defined($ce->{caliper}{custom_actor_generator})) {
return $ce->{caliper}{custom_actor_generator}($ce, $db, $user);
} else {
return generate_default_actor($ce, $db, $user);
}
}
return generate_default_actor($c, $user);
}

1;
Loading