Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
1fc1569
feat: started work on feedback chip api and modifications to learning…
DudeUnleashed Nov 5, 2024
1639205
feat: added feedback chips, migrated learning outcome table changes, …
DudeUnleashed Nov 19, 2024
9eebc54
feat: made changes to feedback chips schema, removing redundant compo…
DudeUnleashed Nov 24, 2024
d0bd918
just committing small changes to work on rebase
DudeUnleashed Nov 30, 2024
5b99b69
feat: started work on feedback chip api and modifications to learning…
DudeUnleashed Nov 5, 2024
182e06c
feat: added feedback chips, migrated learning outcome table changes, …
DudeUnleashed Nov 19, 2024
84c3358
feat: made changes to feedback chips schema, removing redundant compo…
DudeUnleashed Nov 24, 2024
64c39c4
just committing small changes to work on rebase
DudeUnleashed Nov 30, 2024
380df59
Merge branch 'feat/feedback-enhancement' of https://github.com/dudeun…
DudeUnleashed Nov 30, 2024
6cc7b95
fixed migration files
DudeUnleashed Nov 30, 2024
73ab3b5
fixed migration files
DudeUnleashed Nov 30, 2024
dcbecc0
fixed errors and change for learning outcomes polymorphism, added tes…
DudeUnleashed Dec 2, 2024
86ef5a7
fixed migration file errors
DudeUnleashed Dec 2, 2024
deedb3f
fixed database_populator with learning outcome changes
DudeUnleashed Dec 2, 2024
14624bd
fixed database_populator issues
DudeUnleashed Dec 2, 2024
fdd2128
added changes to learning outcome structure and updated everything it…
DudeUnleashed Dec 2, 2024
0a14288
updated task_status in feedback_chips, added some more validation to …
DudeUnleashed Dec 2, 2024
3216720
added the chip analytics table
DudeUnleashed Dec 3, 2024
667fc58
cleaned up the migration files
DudeUnleashed Dec 8, 2024
08c2f43
cleaned up the migration files
DudeUnleashed Dec 8, 2024
ec75dfe
cleaned up the migration files
DudeUnleashed Dec 8, 2024
d577f60
cleaned up the migration files
DudeUnleashed Dec 8, 2024
49f8853
added various endpoints and testing for learning outcomes and feedbac…
DudeUnleashed Dec 9, 2024
982d443
fixed task_definition learning_outcome implementation and added appro…
DudeUnleashed Dec 9, 2024
d2a9813
added dummy data command, added faker to chip factories
DudeUnleashed Dec 10, 2024
cc7253d
added more global outcomes and permissions for them
DudeUnleashed Dec 11, 2024
f382da5
added various validation for feedback chips, more needed endpoints fo…
DudeUnleashed Dec 17, 2024
5f31bda
added test for deleting associated chips when learning outcome is del…
DudeUnleashed Dec 17, 2024
0f8a0e0
updated learning outcome rollovers, exposed list of linked learning o…
DudeUnleashed Dec 20, 2024
6c3a716
updated task status in feedback chips
DudeUnleashed Dec 20, 2024
6b469ba
created test for future migration testing, fixed linked learning outc…
DudeUnleashed Jan 7, 2025
59e6117
fixed wrong learning outcome expose field
DudeUnleashed Jan 7, 2025
ec7840c
added endpoints for learning outcome id, started fix for learning out…
DudeUnleashed Jan 7, 2025
702e439
working on fixing learning outcome link issue
DudeUnleashed Jan 7, 2025
2e5cd5e
fixed learning outcome permissions
DudeUnleashed Jan 12, 2025
73bf183
fixing learning outcome permissions
DudeUnleashed Jan 12, 2025
679851a
fixing learning outcome permissions
DudeUnleashed Jan 12, 2025
ae0a1d7
consolidated and merged feedback template and group api endpoints int…
DudeUnleashed Jan 13, 2025
5c76d94
added endpoints for populating/downloading feedback chips from/to csv
DudeUnleashed Jan 13, 2025
d3214c2
fixed some of the new feedback chip endpoints
DudeUnleashed Jan 13, 2025
7d9a5ab
changed validation of templates to not need parents
DudeUnleashed Jan 13, 2025
cfc7d55
fixed some csv related endpoints/functions
DudeUnleashed Jan 13, 2025
08e19df
changed some return formatting for chips
DudeUnleashed Jan 13, 2025
a2de299
changed some return formatting for chips
DudeUnleashed Jan 13, 2025
d89e0cd
fixed some issues with csv endpoints
DudeUnleashed Jan 13, 2025
ed4826b
fixed some issues with feedback chip post endpoints
DudeUnleashed Jan 13, 2025
a3735c4
fixed some issues with feedback chip post endpoints
DudeUnleashed Jan 13, 2025
7824710
fixed some issues with new csv endpoints
DudeUnleashed Jan 13, 2025
ef4f114
fixed some issues with new csv endpoints
DudeUnleashed Jan 13, 2025
5f3665f
added endpoint for global context chips
DudeUnleashed Jan 13, 2025
00784be
fixed some issues with new csv endpoints
DudeUnleashed Jan 13, 2025
e1999d4
fixed some issues with new csv endpoints
DudeUnleashed Jan 14, 2025
e1c2b3b
added rollover tests for new learning outcomes and chips
DudeUnleashed Jan 14, 2025
c490bb2
fixed some issues with csv generation
DudeUnleashed Jan 14, 2025
67ff1bc
fixed some issues with csv generation
DudeUnleashed Jan 14, 2025
06a74a4
made adjustments to csv read and generation for learning outcomes and…
DudeUnleashed Jan 20, 2025
22ff201
fixed issues with feedback chip csv upload and generation
DudeUnleashed Jan 20, 2025
a2951f2
fixed issues with learning outcome csv upload and generation
DudeUnleashed Jan 20, 2025
2c79023
fixed issues with updating learning outcomes from csv
DudeUnleashed Jan 21, 2025
4da6dbc
added ?include_tlos flag for downloading ulo csv
DudeUnleashed Jan 21, 2025
821ca1a
added context based feedback chip csv upload/download
DudeUnleashed Jan 22, 2025
8b5a0d2
started adding glo upload/download functionality
DudeUnleashed Jan 22, 2025
8dd7d48
added some field restrictions to csv uploading
DudeUnleashed Jan 22, 2025
0147aff
fix: add task_status check for csv upload
DudeUnleashed Jan 22, 2025
5bfafc3
fix: add include_tlo flag to feedback_chip csv download
DudeUnleashed Jan 22, 2025
fa424d3
fix: move group_id storage from summary_text to comment_text
DudeUnleashed Jan 22, 2025
c05f3cb
fix: revert ruby version for development deploy branch
DudeUnleashed Jan 27, 2025
242f38a
fix: update create_from_csv to validate same abbreviation tlos
DudeUnleashed Jan 28, 2025
eecb2ce
fix: fix global group chip creation
DudeUnleashed Jan 28, 2025
57e1e6c
fix: global outcome chip upload
DudeUnleashed Jan 28, 2025
ddb166b
fix: task_status csv validation
DudeUnleashed Jan 28, 2025
1392932
refactor: remove unused files
DudeUnleashed Feb 3, 2025
0b237a7
fix: remove missed api mount
DudeUnleashed Feb 3, 2025
f02b22a
fix: group chip not updating
DudeUnleashed Feb 8, 2025
655493f
fix: add learning outcome abbreviation uniqueness
DudeUnleashed Feb 8, 2025
312e028
Merge branch 'feat/feedback-enhancement' of https://github.com/DudeUn…
macite Mar 20, 2025
2d04b1d
fix: reorder migrations to ensure they run together
macite Mar 20, 2025
0c7144e
enhance: rework the chip usage class
macite Mar 20, 2025
7694726
feat: show outcomes in portfolio and task pdfs
macite Mar 21, 2025
790b5da
docs: document tables for feedback and outcome feature
macite Mar 21, 2025
92a650d
chore: remove legacy text from outcome abbr in migration and test
macite Mar 21, 2025
f038bdd
fix: enhance auth for feedback chips including adding tests
macite Mar 21, 2025
d867d65
test: enhance feedback chip post tests
macite Mar 21, 2025
4cf668b
test: enhance feedback chip tests
macite Mar 21, 2025
fb7770b
test: enhance feedback chip csv tests and fix issues
macite Mar 22, 2025
3bcbdfb
test: add auth post test to learning outcomes api
macite Mar 22, 2025
55d7e90
test: update learning outcome tests and fix functionality
macite Mar 25, 2025
200d1d8
chore: rename learning outcome api test
macite Mar 25, 2025
cc9284c
test: learning outcome link validations and outcome model tests
macite Mar 25, 2025
583b09a
test: fix model check to work for false fields
macite Mar 26, 2025
d22653b
quality: address latest cops
macite Mar 26, 2025
0e41670
test: enhance outcome testing and resolve related issues
macite Mar 27, 2025
51f036a
chore: fix minor cop issue
macite Mar 27, 2025
4c101c5
quality: remove task outcome alignment feature
macite Mar 27, 2025
7385e01
quality: update schema to use utf8mb4 for new databases
macite Mar 27, 2025
ea414cb
test: ensure chip test works with existing learning outcomes
macite Mar 27, 2025
2e90b60
Merge branch 'DudeUnleashed-feat/feedback-enhancement' of https://git…
macite Apr 2, 2025
836e247
fix: ensure task link migration works without model
macite Apr 3, 2025
e62932c
chore: fix cops for learning outcome csvs
macite Apr 3, 2025
dba198e
docs: add comments on institution setting methods
macite Apr 3, 2025
45c0ec2
quality: add timestamps to tables
macite Apr 3, 2025
24c98a7
test: fix schedule job test
macite Apr 3, 2025
31975b7
feat: move to secure cookies and refresh tokens
macite Apr 3, 2025
7a2429d
docs: add details on latex env vars
macite Apr 3, 2025
9ec7672
chore: add ability to list grape routes
macite Apr 4, 2025
50e1310
quality: remove unused routes to minimise surface
macite Apr 4, 2025
b0026ab
fix: correct routes for swagger support
macite Apr 4, 2025
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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ Doubtfire requires multiple environment variables that help define settings abou
| `DF_INSTITUTION_NAME` | The name of your institution running Doubtfire. | _Doubtfire University_ |
| `DF_INSTITUTION_EMAIL_DOMAIN` | The email domain from which emails are sent to and from in your institution. | `doubtfire.com` |
| `DF_INSTITUTION_HOST` | The host running the Doubtfire instance. | `localhost:3000` |
| `DF_COOKIE_DOMAIN` | The domain to be associated with secure cookies. | Attempts to read from host |
| `DF_INSTITUTION_PRODUCT_NAME` | The name of the product (i.e. Doubtfire) at your institution. | _Doubtfire_ |
| `DF_INSTITUTION_HAS_LOGO` | Set to true (or 1) if there is an associated institution logo to be included in the header. | false |
| `DF_INSTITUTION_LOGO_URL` | The url of the logo to include in the header if there is a logo. | /assets/images/institution-logo.png |
| `DF_INSTITUTION_LOGO_LINK_URL` | The url used for the hyperlink associated with clicking the logo. | / |
| `DF_INSTITUTION_HAS_LOGO` | Set to true (or 1) if there is an associated institution logo to be included in the header. | false |
| `DF_INSTITUTION_LOGO_URL` | The url of the logo to include in the header if there is a logo. | /assets/images/institution-logo.png |
| `DF_INSTITUTION_LOGO_LINK_URL` | The url used for the hyperlink associated with clicking the logo. | / |
| `DF_SECRET_KEY_BASE` | The Rails secret key. | Default key provided. |
| `DF_SECRET_KEY_ATTR` | The secret key to encrypt certain database fields. | Default key provided. |
| `DF_SECRET_KEY_DEVISE` | The secret key provided to Devise. | Default key provided. |
Expand Down Expand Up @@ -68,6 +69,9 @@ Doubtfire requires multiple environment variables that help define settings abou
| `D2L_OAUTH_SITE_AUTHORIZE_URL` | The URL to authorize the D2L integration. | `/oauth2/auth` |
| `D2L_OAUTH_SITE_TOKEN_URL` | The URL to get the token for the D2L integration. | `/core/connect/token` |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| **Latex Configuration** | | |
| `LATEX_CONTAINER_NAME` | The name of the container housing the latex image. Used when pdfs are generated. | No default |
| `LATEX_BUILD_PATH` | The path to the latex build script within the container. | /texlive/shell/latex_build.sh |

If you have chosen to use AAF Rapid Connect authentication, then you will also need to provide the following:

Expand Down
5 changes: 3 additions & 2 deletions app/api/api_root.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class ApiRoot < Grape::API
mount ScormExtensionCommentsApi
mount GroupSetsApi
mount LearningOutcomesApi
mount LearningAlignmentApi
mount ProjectsApi
mount SettingsApi
mount StudentsApi
Expand Down Expand Up @@ -99,6 +98,8 @@ class ApiRoot < Grape::API
mount WebcalApi
mount WebcalPublicApi

mount Feedback::FeedbackChipApi

#
# Add auth details to all end points
#
Expand All @@ -111,7 +112,6 @@ class ApiRoot < Grape::API
AuthenticationHelpers.add_auth_to ScormExtensionCommentsApi
AuthenticationHelpers.add_auth_to GroupSetsApi
AuthenticationHelpers.add_auth_to LearningOutcomesApi
AuthenticationHelpers.add_auth_to LearningAlignmentApi
AuthenticationHelpers.add_auth_to ProjectsApi
AuthenticationHelpers.add_auth_to StudentsApi
AuthenticationHelpers.add_auth_to Submission::PortfolioApi
Expand Down Expand Up @@ -139,6 +139,7 @@ class ApiRoot < Grape::API
AuthenticationHelpers.add_auth_to TestAttemptsApi

AuthenticationHelpers.add_auth_to D2lIntegrationApi::D2lApi
AuthenticationHelpers.add_auth_to Feedback::FeedbackChipApi

add_swagger_documentation \
base_path: nil,
Expand Down
37 changes: 30 additions & 7 deletions app/api/authentication_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AuthenticationApi < Grape::API
helpers AuthorisationHelpers

#
# Sign in - only mounted if AAF auth is NOT used
# Sign in - only mounted if AAF and SAML auth is NOT used
#
if !AuthenticationHelpers.aaf_auth? && !AuthenticationHelpers.saml_auth?
desc 'Sign in'
Expand All @@ -29,10 +29,6 @@ class AuthenticationApi < Grape::API
remember = params[:remember]
logger.info "Authenticate #{username} from #{request.ip}"

# Truncate the 's' from sXXX for Swinburne auth
truncate_s_match = (username =~ /^[Ss]\d{6,10}([Xx]|\d)$/)
username[0] = '' if !truncate_s_match.nil? && truncate_s_match.zero?

# No provided credentials
if username.nil? || password.nil?
error!({ error: 'The request must contain the user username and password.' }, 400)
Expand Down Expand Up @@ -72,7 +68,8 @@ class AuthenticationApi < Grape::API

# Return user details
present :user, user, with: Entities::UserEntity
present :auth_token, user.generate_authentication_token!(remember: remember).authentication_token
present :auth_token, user.generate_authentication_token!.authentication_token
add_refresh_cookie_to_response(remember)
end
end

Expand Down Expand Up @@ -232,6 +229,7 @@ class AuthenticationApi < Grape::API
params do
requires :username, type: String, desc: 'The user\'s username'
requires :auth_token, type: String, desc: 'The user\'s temporary auth token'
optional :remember, type: Boolean, desc: 'User has requested to remember login', default: false
end
post '/auth' do
error!({ error: 'Invalid authentication details.' }, 404) if params[:auth_token].blank? || params[:username].blank?
Expand All @@ -252,6 +250,7 @@ class AuthenticationApi < Grape::API
# Respond user details with new auth token
present :user, user, with: Entities::UserEntity
present :auth_token, token.authentication_token
add_refresh_cookie_to_response(params[:remember])
end
end
end
Expand Down Expand Up @@ -356,14 +355,27 @@ class AuthenticationApi < Grape::API
}
delete '/auth' do
user = User.find_by(username: headers['username'] || headers['Username'])
token = user.token_for_text?(headers['auth-token'] || headers['Auth-Token'], :general) unless user.nil?
token = user&.token_for_text?(headers['auth-token'] || headers['Auth-Token'], :general)

if token.present?
logger.info "Sign out #{user.username} from #{request.ip}"
token.destroy!
end

if cookies['refresh_token'].present?
auth_param = cookies['refresh_token']
user_param = cookies['username']

user = User.find_by(username: user_param)
token = user&.token_for_text?(auth_param, :refresh_token)
if token.present?
logger.info "Sign out #{user.username} from #{request.ip}"
token.destroy!
end
end

present nil
add_refresh_cookie_to_response(false)
end

desc 'Get SCORM authentication token'
Expand All @@ -382,4 +394,15 @@ class AuthenticationApi < Grape::API
present :scorm_auth_token, token.authentication_token
end
end

desc 'Get access token from the refresh token cookie'
post '/auth/access-token' do
if authenticated?(:refresh_token)
# Return user details
present :user, current_user, with: Entities::UserEntity
present :auth_token, current_user.generate_authentication_token!(token_type: :general).authentication_token
else
error!({ error: 'Invalid refresh token.' }, 404)
end
end
end
10 changes: 7 additions & 3 deletions app/api/entities/learning_outcome_entity.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module Entities
class LearningOutcomeEntity < Grape::Entity
expose :id
expose :ilo_number
expose :context_type
expose :context_id
expose :abbreviation
expose :name
expose :description
expose :short_description
expose :full_outcome_description
expose :linked_outcome_ids do |learning_outcome, _options|
learning_outcome.linked_outcomes.pluck(:id)
end
end
end
1 change: 0 additions & 1 deletion app/api/entities/project_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ProjectEntity < Grape::Entity

expose :tutorial_enrolments, using: TutorialEnrolmentEntity, unless: :summary_only
expose :groups, using: GroupEntity, unless: :summary_only
expose :task_outcome_alignments, using: TaskOutcomeAlignmentEntity, unless: :summary_only

expose :grade, if: :for_staff
expose :grade_rationale, if: :for_staff
Expand Down
2 changes: 2 additions & 0 deletions app/api/entities/task_definition_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ def staff?(my_role)
expose :overseer_image_id, if: ->(unit, options) { staff?(options[:my_role]) }, expose_nil: false
expose :assessment_enabled, if: ->(unit, options) { staff?(options[:my_role]) }
expose :moss_language, if: ->(unit, options) { staff?(options[:my_role]) }, expose_nil: false

expose :learning_outcomes, using: LearningOutcomeEntity, as: :ilos
end
end
10 changes: 0 additions & 10 deletions app/api/entities/task_outcome_alignment_entity.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/api/entities/unit_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def can_read_unit_config?(my_role)
# expose :tutorial_enrolments, using: TutorialEnrolmentEntity, unless: :summary_only, if: lambda { |unit, options| is_staff?(options[:my_role]) }

expose :ordered_task_definitions, as: :task_definitions, using: TaskDefinitionEntity, unless: :summary_only
expose :task_outcome_alignments, using: TaskOutcomeAlignmentEntity, unless: :summary_only
expose :group_sets, using: GroupSetEntity, unless: :summary_only
expose :groups, using: GroupEntity, unless: :summary_only
# expose :group_memberships, using: GroupMembershipEntity, unless: :summary_only do |unit, options|
Expand Down
24 changes: 24 additions & 0 deletions app/api/feedback/entities/feedback_chip_entity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Feedback
module Entities
class FeedbackChipEntity < Grape::Entity
expose :id
expose :type do |chip|
case chip.type
when 'Feedback::FeedbackTemplateChip'
'template'
when 'Feedback::FeedbackGroupChip'
'group'
else
'unknown'
end
end
expose :chip_text
expose :description
expose :task_status
expose :parent_chip_id
expose :learning_outcome_id
expose :summary_text
expose :comment_text
end
end
end
21 changes: 21 additions & 0 deletions app/api/feedback/entities/feedback_group_chip_entity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Feedback
module Entities
class FeedbackGroupChipEntity < Grape::Entity
expose :id
expose :type do |chip|
case chip.type
when 'Feedback::FeedbackTemplateChip'
'template'
when 'Feedback::FeedbackGroupChip'
'group'
else
'unknown'
end
end
expose :chip_text
expose :description
expose :parent_chip_id
expose :learning_outcome_id
end
end
end
25 changes: 25 additions & 0 deletions app/api/feedback/entities/feedback_template_chip_entity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Feedback
module Entities
class FeedbackTemplateChipEntity < Grape::Entity
expose :id
expose :type do |chip|
case chip.type
when 'Feedback::FeedbackTemplateChip'
'template'
when 'Feedback::FeedbackGroupChip'
'group'
else
'unknown'
end
end
expose :chip_text
expose :description
expose :task_status
expose :parent_chip_id
expose :learning_outcome_id

expose :comment_text
expose :summary_text
end
end
end
Loading
Loading