Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Oct 2012 at 22:52 UTC
Updated:
4 Jan 2014 at 02:42 UTC
Jump to comment: Most recent
Comments
Comment #1
scottrigbyHi John,
Glad to see your group's work on this! From just reviewing code (am not set up at the moment to try providing or consuming), this is much more in line with Drupal standards (and much more developed) than samo's BasicLTI sandbox project.
After a scan last night (while waiting to see if the hurricane would cut out our power!) - here are a few responses:
Important
require_once(drupal_get_path('module', 'user') . '/user.pages.inc');calls a Drupal API function outside of a function body, which should not be done. See #1751704: Code should not call Drupal API functions outside of a function bodyMinor
hook_menu()items, etc).drupal_goto()(in_lti_tool_provider_launch(),_lti_tool_provider_return(), and_lti_tool_provider_home()). See #102138: cron breaks on drupal_goto and #308808: Drupal_cron_cleanup paints the wrong picturefiles[] = lti_tool_provider.installdoes not need to be listed in the info file because that file doesn't contain any class or interface declarations. See http://drupal.org/node/542202#filesOpinions
Comment #2
mradcliffeI wrote up a review, but didn't post it yet. I think the approach is sound with some issues noted above. I don't think there are many "major" issues that would prevent this from being a contrib module other than the function naming that scottrigby mentioned. I would consider the drupal_goto() in cron a major issue because it could have some unattended side effects for sites.
Everything else is a minor issue.
Also, see #1827050: Consider using get_parameters method instead of $_POST.
Edit: Probably a note that it may be incompatible with oauth (oauth_common), oauth_api (oauth), and other modules that bundle OAuth directly on the project home page.
Edit 2: I was considering "major" as blocking issues in review, but my concept of major is not correct.
Comment #3
scottrigbyAgreed that "major" in #1 sounds a little too close to "critical". I think only the namespacing qualifies for that.
After a quick chat with mradcliffe on IRC I edited & changed the header in my comment to "important", because IMO those other points still are more than minor to sort out, whether before or after promoting to a full project.
Comment #4
jzornig commentedHi Scott,
Thanks for the review. I spent the day working through all your points major and minor. I've committed a new version that should address them all. I'll have a look at the possibility of the feature requests after the outcomes and memberships submodules are finished.
Regards,
JZ
Comment #5
jzornig commentedMatthew,
I changed to using the get_parameters as you suggested.
JZ
Comment #6
scottrigbyNice work John - This all looks great (aside from my other suggestions, which can be taken up in the issue queue).
The only other coding standards-related thing i noticed today I just made a follow-up issue in the queue [#Convert dos-style line endings to unix-style], but that's something that can also be done at any point (probably sooner than later though, otherwise patches would be difficult)
Comment #7
scottrigbyAccidental change of status - i need to remember to refresh the page.
In fact this should be RTBC from my point of view, but I'll wait for another opinion.
Comment #8
jzornig commentedI've fixed the line endings. I have a couple of student interns working on the submodules and one of them had their eclipse set to windows line endings;-)
Comment #9
taslett commentedHi John,
I had a quick look, overall it looks really good, well done.
I have a couple of suggestions for improvement.
Some of the functions are pretty big, it would be good to refactor them a little.
One example is function _lti_tool_provider_launch() you could pull out the og related stuff which is about half the function, possibly put it in an inc file.
You also have a class in the module file that would be better in it's own file.
Comment #10
jzornig commentedThanks Tony,
Both of your recommendations were already on the todo list and you should see them in the next commit, tonight or tomorrow.
Thanks JZ
Comment #11
klausiWe are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #12
jzornig commentedAll the changes requested by the three reviewers have been made and committed. The module has been run through coder and coder tough love. Our efforts are now to finish development of two submodules that build upon this one. It would be good to be able to release the current module for download as there is a lot of interest in it.
Comment #13
klausiDon't RTBC your own application. See http://drupal.org/node/532400
Comment #14
jzornig commentedOK, I wasn't able to find that page, the process seemed complete.
Can the reviewers please indicate if they have other issues and if not can one of you set the status.
Comment #15
taslett commentedThis module seems solid and ready for full release.
Changing the status to reviewed
Comment #16
btopro commentedCan also confirm working. I think this is ready for full project status given acceptance of changes asked for by the community in this thread as well as multiple confirmations of code working. This is a great need in the education community as it will allow Drupal to talk to all major LMSs on the market.
Comment #17
btopro commentedDid a coder audit set to find minor issues and only 1 white space at end of line came up: #1845090: lti_tool_provider.admin.inc Line 443: There should be no trailing spaces (very clean)
Comment #18
mradcliffeLooks RTBC to me too.
Comment #19
elc commentedJohn, it seems I can't email you at all as I get no reply and no bounce.
The project page is great, the overall coding looks good if not a little crowded (made in an IDE that auto spaces braces? no crime), translated strings are mostly there, but there are some small things to fix and some rather larger ones that should either be fixed or rebutted. As I don't have a system I can tie this into, there may be aspects that influence why these choices were made that I cannot know.
Look out, my list of things extended beyond a few. Some of this is just commentary that I hope will be digested and perhaps integrated. Given the interest in the module it shouldn't be hard to either rebut or fix most of this swiftly as it really should be the best it can be. Given the issues missed in reviews, I think those should be dealt with before the project moves to a full project.
It has taken 12+ hours to review this to this extent so let's consider this a constructive discourse.
Should be addressed or fixed now
The project line in the lti_tool_provider_og sub-module must be removed. This is added by the packaging system automatically.
Checking it subsequently at runtime would then not be needed, except perhaps to check the version after an update but that would be an even larger job and part of a major version release and update functions so again probably not needed.
The conditional wrapper around the class would also not be needed. Conditionally wrapping a class seems very questionable.
I would highly recommend clearing this up.
The loading of the library should done just prior to its first use in code rather than on every page load also as there will be many pages where it would not be needed, especially for anonymous users.
Coding standards on Object-oriented code
require_once $library['library path'] . '/OAuth.php';And potentially include DRUPAL_ROOT unless $library['library path'] already includes this. Does it really need a require_once after using the libraries API to load the PHP library?
eg. lti-tool-provider/return, lti-tool-provider/home, lti-tool-provider/info into a pages.inc?
The method used in here to fill the table cells is normally used when making a table full of FAPI fields, not just displaying text. Bit of an overkill, but it works.
The values should be run through check_plain as they appear to be user entered values in the next form. It seems also needed in lti_tool_provider_consumer_view as the values are dumped directly to HTML there too.
There preg_match of the domain just below that should probably be before it's run through every other validation function. It would almost be the first thing to look for, not the last.
Consider putting the action buttons of a form inside of a '#type' => 'actions' as "Use of the 'actions' element as an array key helps to ensure proper styling in themes and to enable other modules to properly alter a form's actions."
My assumption for the next part is that not all schema fields will want to be included in the display of a single consumer entity. There will be fields on there that do not need to be included, and the creator of the entity is most likely the person to know that. As a result, you could create a new hook_XXXXX_info() setup to describe only your entities' interesting fields in a translated format. At present it really is using secret sauce.
The 'module' key is only used by Entity API, but nothing else is enabling any aspects of that module such as views detection or making them exportable. Am I missing something?
http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...
There are variables that are not guaranteed to be here, that are even being casually checked for existence that if not present will cause PHP Notice errors. Please ensure that code is E_ALL clean.
Exception message should be sanitised for display as it's source is external code/interface. Some of the error messages seem not to be translated? Is this intentional?
Some items that caught my eye
'Launched' string should be translated.
lti_tool_provider_goto should behave just like drupal_goto and never return, instead exiting via drupal_exit() and preventing the need for a return statement in the other function.
#submit array provided to lti_tool_provider_user_attributes is superfluous as this is the default value added by FAPI, as shown by the undeclared #validate. Same with the explicitly set default #submit array in lti_tool_provider_global_roles. No real need to change this, it's just unexpectedly stating the obvious.
For the future
Given the model employed in this project, any other contributors should also have d.o accounts which can be credited with the commit even if they are not maintainers, allowing you to vet all the commits.
ED: remove uninstall issue (I'm blind), add some clarifications, and fix spellings.
Comment #20
jzornig commentedELC thanks for this comprehensive review. I really appreciate the time you've spent on this. I'm working my way through it and committing the changes as I go. I had a few issues with my eclipse ide setup that caused some trouble with git. Hopefully all sorted now. i was very busy last week and so It is taking a while to get through all the changes. I hope to be done in the next day or so. I'll change status to needs review when I'm done.
Comment #21
jzornig commentedI've committed the following changes to address these issues.
Line endings and File endings - Fixed DOS line endings, don't know how this happened as I had already fixed this and somehow it got reverted. I'm not even using windows.
.info file package and project - Added a package = "Learning Tools Interoperability" in the .info files to group all the LTI related modules.
Class filenames - While the coding standards do not specify a filename style for classes, When I look in other modules that use classes they are mostly doing it the way I have it. Examples are ctools, ldap, og, entity reference. Some modules use CamelCaseName.inc rather than CamelCaseName.class.php but the only ones I found with classes in module_name.inc files had non-camelcase class names which is wrong according to the style guide. I was copying what seemed to be the accepted practice. I have currently left the filenames as they are. This seems to be closer to the naming practice for class files in D8.
hook_init and a conditionally wrapped class - I've had a lot of trouble with this. Because LTIToolProviderOAuthDataStore extends OAuthDataStore and LTIToolProviderOAuthDataStore is autoloaded because of the files[] = LTIToolProviderOAuthDataStore.class.php line. If the oauth library is not installed and loaded when the module is enabled you get a white screen and your site is hosed. The libraries module doesn't seem to work in this situation because the library info is declared in the lti_tool_provider.module file, it is not registered with the libraries module at the time the lti_tool_provider.install file is run, so the libraries module doesn't yet know about the oauth library, but as soon as the module is enabled you have a white screen because of the class loader. The solution I've implemented is to use hook_registry_files_alter() to add the OAuth.php to the autoload registry.
classes and lowerCamelCase, delete_multiple is there because is an exact copy of the entity example from the example module. I have changed it to deleteMultiple.
require/include_once - fixed with the changes referred to in hook_init above
admin.inc - Moved the launch, return, home and info menu items to lti_tool_provider_operations.inc
hard coding in lti_tool_provider_get_lti_roles - The variable stores the mapping of these to drupal roles. I removed the check_plain.
lti_tool_provider_consumers_admin - table theme - Fixed this to use the #empty attribute.
form_set_error('', 'msg')) and lti_tool_provider_consumer_form - I've added field selectors to all the form_set_error() calls.
lti_tool_provider_retrieve_user_field_types - user output - renamed function and added comment on display safety.
lti_tool_provider_get_column_desc - this was actually some functionality no longer needed so I have removed it.
lti_tool_provider_create_account - example.com - I've changed example.com to invalid, which seems to be best practice for email addresses that should not generate emails.
Entity module vs implemented entity - entity api is now only used in the og sub-module so I have removed the dependency.
lti_tool_provider_entity_info - invalid keys - Added the bundles element ith a default bundle of lti_tool_provider_consumer to hold the access arguments and path.
lti_tool_provider_launch - sanitised output, checked for all array keys prior to use. The custom_destination is added to the destination determined by the normal process of the modules. I.e. if a module such as lti_tool_provider_og changes the standard destination to be a group home page, then the custom destination is a path within the group relative to the home page. I've simplified lti_tool_provider_home by storing the computed destination in the session. I was moving away from the launch hook to just having the launch_alter hook.
lti_tool_provider_return_title and lti_tool_provider_home_title - added check_plain and t processing.
lti_tool_provider_return and lti_tool_provider_goto - removed unreachable return.
lti_tool_provider_info and lti_tool_provider_user_attributes - Fixed info to use #empty. user_attributes will never be empty.
pareview now just gives a couple of false positives.
Comment #22
elc commentedLots of fixes, but a few issues from the list still exist, however the project is being managed as a full project already and it is ready for going to a live project as it would be better served as one. The community of users for the project will be able to find and fix any issues much better than anyone reviewing it in the queue.
I've opened up the following issues on the project to be rectified like normal bugs.
#1858628: lti_tool_provider_goto wrapper should function like the thing is wrapping
#1858646: Static strings not translated
I was going to completely call it all off when I saw that "else if" in there ;) #1851820: Lookup user by lis_person_contact_email_primary
Comment #23
elc commentedThere's no way to change these now, but you've actually credited me and others for work that you have done in the commit messages - I only reported the issue, but you did all the work. The commit message would then be "Issue #1858646 by jzornig: Fixed some untranslated strings." unless I'd actually made some kind of useful contribution towards the solution instead of just reporting it.
If someone submits a patch that you use verbatim (or a high percentage of), you would also credit them as the author of the commit using cmd line options. eg. for you
--author="jzornig <jzornig@446626.no-reply.drupal.org>. This is listed on every users profile page. http://drupal.org/user/446626See Adding a commit author and Commit messages - providing history and credit
Anyway, since this project is well on it's way and you have demonstrated a good understanding on the Drupal API ..
Thanks for your contribution, John! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Comment #24
jzornig commentedThanks ELC. I've promoted the module and generated a dev release. It will be a busy December for me getting the memberships and outcomes modules fully tested and committed ready for the alpha release.
Comment #25
btopro commentedThank you ELC and congratulations jzornig, this is a huge step forward for the drupal in education community!
Comment #26.0
(not verified) commentedchanged git clone to include 7.x-1.x branch