Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX][SOLAR-387] Add fallback when no registration available or FF TAO_AS_A_TOOL is disabled #392

Conversation

andreluizmachado
Copy link
Contributor

We should redirect the user to the default login page in case:

  1. The FF is not enabled
  2. The LTI Platform config is missing

Please check the bug ticket for more details.

Demo

Current Behavior

current.mov

The fix

bugfix.mov

@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (2e78ef5) 30.59% compared to head (af49cb5) 30.35%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #392      +/-   ##
=============================================
- Coverage      30.59%   30.35%   -0.25%     
- Complexity       817      822       +5     
=============================================
  Files            104      104              
  Lines           2853     2876      +23     
=============================================
  Hits             873      873              
- Misses          1980     2003      +23     
Files Coverage Δ
controller/AuthoringTool.php 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pribi pribi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful
  • Pull request's target is not master

controller/AuthoringTool.php Outdated Show resolved Hide resolved
Copy link
Contributor

@bartlomiejmarszal bartlomiejmarszal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Checklist

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful
  • Pull request's target is not master
  • Commits are following conventional commits
  • Commits messages are meaningful
  • Commits are atomic
  • Changelog is updated according to changes (if applicable)
  • Documentation is updated according to changes (if applicable)

controller/AuthoringTool.php Show resolved Hide resolved
controller/AuthoringTool.php Outdated Show resolved Hide resolved
Copy link
Contributor

@bartlomiejmarszal bartlomiejmarszal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recommendation is to fallback into redirect after we catches exception from . getValidatedLtiMessagePayload method

controller/AuthoringTool.php Outdated Show resolved Hide resolved
controller/AuthoringTool.php Show resolved Hide resolved
@andreluizmachado
Copy link
Contributor Author

My recommendation is to fallback into redirect after we catches exception from . getValidatedLtiMessagePayload method

If I understood correctly this is what I am doing.

try {
$message = $this->getValidatedLtiMessagePayload();
} catch (LtiException $exception) {
if ($exception->getMessage() !== self::LTI_NO_MATCHING_REGISTRATION_FOUND_MESSAGE) {
Copy link
Contributor

@bartlomiejmarszal bartlomiejmarszal Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use an Exception code or Exception type to define this not a message string. This is a blocker for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes exceptions don't implement the code and its hard to add it, maybe that's the case. But of course better would be to use code of specific exception class to check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Karol-Stelmaczonek , yes, I do not have a code here. I would use it in case I have it, ofc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make changes to the exception so it will be easy to recognise the type of exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid creating a new release on Lti1p3Core only for this.

Copy link
Contributor

@bartlomiejmarszal bartlomiejmarszal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is the fallback mechanism and we could title this PR as add fallback when no registration available. This is an important change and we should be careful with our changes and we should describe them with clarity. Also, I would say it is a feature, not a bug.

@github-actions
Copy link

Version

Target Version 15.14.1
Last version 15.14.0

There are 0 BREAKING CHANGE, 0 feature, 2 fixes

@andreluizmachado
Copy link
Contributor Author

IMO this is the fallback mechanism and we could title this PR as add fallback when no registration available. This is an important change and we should be careful with our changes and we should describe them with clarity. Also, I would say it is a feature, not a bug.

It's not common to refer to a "fallback" as a "feature." Typically, a "fallback" is a contingency strategy or action triggered when something doesn't work as expected, or when a system cannot perform its primary task. For example, in programming, a "fallback" can be an alternative function that is executed if the main function fails. In security systems, a "fallback" can be a backup procedure in case the primary systems fail.

A "feature" is usually a planned and desired functionality of a system, product, or service that is designed to meet specific user needs. Features are intentional components of a system, while a "fallback" is a contingency response to unforeseen situations.

In summary, it's not appropriate to say that a "fallback" is a "feature" because they serve different roles in a system or product.

@andreluizmachado andreluizmachado changed the title [FIX][SOLAR-387] verify if feature is enabled and if platform config is available [FIX][SOLAR-387] Add fallback when no registration available Oct 18, 2023
@andreluizmachado andreluizmachado changed the title [FIX][SOLAR-387] Add fallback when no registration available [FIX][SOLAR-387] Add fallback when no registration available on FF FEATURE_FLAG_TAO_AS_A_TOOL is disabled Oct 18, 2023
@andreluizmachado andreluizmachado changed the title [FIX][SOLAR-387] Add fallback when no registration available on FF FEATURE_FLAG_TAO_AS_A_TOOL is disabled [FIX][SOLAR-387] Add fallback when no registration available on FF TAO_AS_A_TOOL is disabled Oct 18, 2023
@andreluizmachado andreluizmachado changed the title [FIX][SOLAR-387] Add fallback when no registration available on FF TAO_AS_A_TOOL is disabled [FIX][SOLAR-387] Add fallback when no registration available or FF TAO_AS_A_TOOL is disabled Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants