Hi,

The SuperSaaS module displays a "Book now" button that automatically logs the user into a SuperSaaS schedule using his Drupal user name. It passes the user's information along, creating or updating the user's information on SuperSaaS as needed. This saves users from having to log in twice.

Sandbox Project Link: SuperSaaS

Setting up repository for the first time:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/SuperSaaS/2508934.git supersaas

Documentation available at: SuperSaaS Drupal Integration

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PA robot’s picture

Status: Needs review » Needs work

Git clone command for the sandbox is missing in the issue summary, please add it.

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

supersaas’s picture

Issue summary: View changes
Status: Needs work » Needs review
supersaas’s picture

Issue summary: View changes
PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxSuperSaaS2508934git

I'm a robot and this is an automated message from Project Applications Scraper.

supersaas’s picture

Status: Needs work » Needs review
saurabh.tripathi.cs’s picture

Status: Needs review » Needs work

HI,
Please provide proper Git clone command:
Please follow instructions:

You can find the correct git clone command for your sandbox by clicking on the Version control tab, removing the checkbox in front of "Maintainer", and clicking Show. You can then copy-paste the git clone command from the codeblock below "Setting up repository for the first time".

klausi’s picture

Status: Needs work » Needs review

Anyone can fix the git clone command in the issue summary, please do that. That alone should not block this application.

supersaas’s picture

Hi,

The main branch name is actually 7.x-1.x. The "Setting up repository for the first time" section from the issue summary does clone the project.

Do you have suggestions for using a different branch name?

heykarthikwithu’s picture

Reviewed by Coder module

Problem:
Line 61: Use the Form API to build forms to help prevent against CSRF attacks. (Drupal Docs) [security_18]
$out = '<form method="post" action="http://' . ($domain ? $domain : t('www.supersaas.com')) . '/api/users">';

Solution: Described in the patch file.

heykarthikwithu’s picture

Issue summary: View changes

fix for the git clone command.

supersaas’s picture

Hi heykarthikwithu,

I have analysed your suggestions and I have the following comments.

1. Use of the form API and CSRF protection on the Single Sign-on form

This module is a Cross Site Single Sign-on solution between a Drupal server and the SuperSaaS service that uses a single request for signing in a Drupal user to the SuperSaaS service. The issuer of the login form is a Drupal server and the form gets posted to the SuperSaaS server. So, Drupal's builtin CSRF token protection cannot be used, as the SuperSaaS server has no knowledge about the token provided by the Drupal server. On the other hand, nothing gets posted to the Drupal instalment using this module. This means that the Drupal server will not be exposed to CSRF attacks in any way by using our module. Last but not least using Drupal's form API would mean that some extra parameters(form-token, form-build-id) would be sent to the SuperSaaS API that are totally meaningless and out of the context for the SuperSaaS API. So, using the Drupal form API makes no sense in our case.

2. Use of drupal_add_js

I have seen that you proposed the use of drupal_add_js in your patch. I have added a method for loading the JS code inline with the drupal_add_js method. Given the fact that we have only 2 lines of JS, loading them inline makes more sense to me.

3. Changing the repository setup instructions

I also noticed that you have changed the old repository setup instructions that were

git clone --branch 7.x-1.x SuperSaaS@git.drupal.org:sandbox/SuperSaaS/2508934.git supersaas
cd supersaas

Did the old instructions not work for you? I just tried them again and I could clone the repo.

Thanks for reviewing the SuperSaaS module and if your have further questions or comments let me know.

Veeramani Murugadoss - Drupal Geeks’s picture

Hi,

*. It is not a right way to include a raw form in the module file. The raw form include in the supersass.module,

function supersaas_block_view($delta = '') { 
 ...
 $out = '<form method="post" action="http://' . ($domain ? $domain : t('www.supersaas.com')) . '/api/users">';
 ...

can be refactored by moving the form into a hook_form() or custom form builder function implementation. Also you can return the form in the hook_block_view() by using drupal_get_form(). For more info - https://www.drupal.org/node/1394018

*. The raw java script include in the module file doesn't seems to be right.

$out .= '</form><script type="text/javascript">function confirmBooking() {';
$out .= "var reservedWords = ['test','supervise','supervisor','superuser','user','admin','supersaas'];";
$out .= "for (i = 0; i < reservedWords.length; i++) {if (reservedWords[i] === '{$user->name}') {return confirm('";
$out .= t('Your username is a supersaas reserved word. You might not be able to login. Do you want to continue?') . "');}}}</script>";

You can either use drupal_add_js() or if you want to include the JS to a form then you can make use of Form API #attached property. For more info - https://www.drupal.org/node/304255

Thanks,

Veeramani Murugadoss - Drupal Geeks’s picture

Veeramani Murugadoss - Drupal Geeks’s picture

Veeramani Murugadoss - Drupal Geeks’s picture

Hi,

*. Please remove one of the README file. It contains both the README.txt and README.md file. It would be best that if you can format the file based on the README template - https://www.drupal.org/node/2181737 and also provide an additional info like "After enable the module goto blocks configuration page to enable the 'SuperSaaS Login' block" in the README file.

*. Please remove the error_log() statements in supersaas_help() and supersaas_permission().

*. I guess it is a good idea to make use of Drupal Form API wherever it is possible. Even though you are passing the data to a 3rd party site, it is best recommended to use Drupal Form API to construct the form and change either the $form['#action'] or include the $form['#redirect'] property to submit the data to the 3rd party url. Also it is recommended to make use of $form['#attached']['js'] to include any JS to the form.
On the other hand if you dont want to pass Drupal form-token, form-build-id then why don't you build a drupal_http_request() to post the data to SuperSaas service instead of using the raw form or Form API to make it follow the Drupal standards?.

Thanks,

supersaas’s picture

Hi Veeramani,

Thanks for your review! I have removed the error_logs and changes regarding your other comments are on the way.

supersaas’s picture

Hi heykarthikwithu & Veeramani,

I have implemented the changes suggested by you:

* Refactored the supersaas_block_view hook. The form is built using the Drupal Form API in the supersaas_login form hook. I also made use of a hook_form_FORM_ID_after hook in order to remain compliant with the SuperSaaS API and keep the original architecture.
* I have moved the JavaScript code to a .js file and included it into the form as you suggested.
* I have removed the README.md file and reformatted the README.txt file in accordance with the Drupal README template.

Could you please give me a feedback on the solution? Also if you see any other issues, let me know. Thanks.

Cheers,
supersaas

heykarthikwithu’s picture

FileSize
187.9 KB

Reviewed by coder module, but found few drupal coding standard errors, find the attached document.

And also check below link
http://pareview.sh/pareview/httpgitdrupalorgsandboxsupersaas2508934git

supersaas’s picture

I have fixed the Drupal Coding Standard errors:

http://pareview.sh/pareview/httpgitdrupalorgsandboxsupersaas2508934git

gisle’s picture

I've looked at the latest commit, which us for Drupal 8, and this is just a single point in the Project Application Review Template, but I suggest you address it while waiting for a more complete review:

Licensing
No.
- Please remove the COPYRIGHT.md file.
Drupal will add the appropriate license file automatically during packaging so your repository should not include it. See https://www.drupal.org/node/1587704#licensingchecks
- You must also remove CODE_OF_CONDUCT.md.
Drupal already has a code of conduct: https://www.drupal.org/dcoc. If you find it lacking, you need to go through normal community channels to get it amended. Your CODE_OF_CONDUCT.md comes acoss as misleading, as it describes a number of rights that project maintainers are supposed to have, and things that project maintainers are supposed to do. Neither is applicable here.
- I would also recommend that you remove CONTRIBUTING.md. There exists an established workflow for contribution to a project hosted at Drupal.org. Establishing an alternative contribution workflow for your project does not look to me as a good idea.

I hope somebody else gets around to look at the other review points soon - I've noticed you've waited 10 months for a manual review.

However, you may make things more complicated for reviewers than necessary by pushing two different branches (one for D7 and one for D8) into the repo at the same time. There's a lot of projects to review, and having to deal with two branches doubles the work for the reviewer.

supersaas’s picture

Hi Gisle,

Thank you for taking a look. I agree with you, I removed those files in a4ffaca.

In regards to multi-branches, actually I was not aware that my D8 branch will trigger an update for this issue. Do you suggest deleting D8 branch temporarily for now? Or creating another issue specially for D8?

Cheers,
Laith

gisle’s picture

In regards to multi-branches, actually I was not aware that my D8 branch will trigger an update for this issue. Do you suggest deleting D8 branch temporarily for now?

If you want this application resolved (I am not going to say "quickly", because that would raise false hopes), my advice would be that you delete the D8 branch. You can add it back after your project has been approved.

Or creating another issue specially for D8?

Don't do that! That will just trigger the "duplicate detector" sensor of our dear robot, and one of your issues (choosen at random) will immediately be closed.

gisle’s picture

I've tried to test your project, but I'm unable to configure it correctly. I've set it up as described in the README-file, and I've created an admin account at SupeSaaS website, and set it up as described here: https://www.supersaas.com/info/doc/integration/drupal_integration - including "Troubleshooting tips" at the bottom.

It works as expected when I test it inside the SuperSaaS dashboard (using the built-in test feature).

I am able to get the button to show up on the Drupal site, but pressing the button produces.

<errors>
  <error>Email is not a valid email address</error>
</errors>

Troubleshooting tips say:

If you see an error Email is not a valid email address, then please read the previous paragraph again to confirm you have made the correct settings in your SuperSaaS account

The previous paragraph says: "Note that the button only appears to users who are logged in to your Drupal site".

Since the button appears, and I am logged in, this is not really much help.

The part that says "confirm you have made the correct settings in your SuperSaaS account" isn't much help either. I already know that my settings are not correct (since it does not work). I even think that it is very likely that it is some email setting that is wrong.

However, checking the settings for my user at Drupal, and at SuperSaaS, both are set up with working email addresses, so it is not very obvious where I have to look to find the incorrect setting.

supersaas’s picture

Hi Gisle,

Thanks for taking the time to try out the project! That error message typically means that you've missed the step in the instructions that says: "Deselect the option "Use email address as login name", which can be found on the Access Control page in your SuperSaaS account. I agree that the documentation could phrase the comment next to the error message more clearly, I'll pass that on. Feel free to contact me directly on support@supersaas.com if you have any further question.

gisle’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -single sign-on

I've removed some random keywords you've added to the tag field.

Before adding tags read the issue tag guidelines. Do NOT use the tag field for adding random keywords.

There are two branches in the repo. There is some confusion about what branch the applicant want reviewed (see comments under "Master branch" below). This review is of the 7.x-1.x branch.

Automated Review

PAReview (ESLint) complains about an unused JavaScript variable that should be removed. There are no automated test cases. Adding test cases are strongly recommended, but they are not mandatory.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
No: Does not follow the guidelines for master branch.
You've set the default branch to 8.x.2.x, but the [D7] in the title of your application and the git clone command provided indicate that you're submitting the 7.x-1.x branch for review. You need to make up your mind about what you want reviewed (and adjust either the default branch or the title accordingly).
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
Project page
No. Please take a moment to make your project page follow the Project page template and it may be a good idea to also read tips for a great project page.
In particular, you should add the section "Dependencies". This module depends on SaaS delivered by SuperSaaS. This dependency, and pricing must be disclosed on the project page.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template. It should be noted that "Troubleshooting Tips" didn't help me when I had trouble - but bad UX is not a blocker in the review queue (but may lose you some business).
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements. (But see comment about MD5 below.)
Coding style & Drupal API usage
  1. You use md5() to compute the checksum sent to the SaaS. I understand that the choice of hash function may not be yours to make, but read this: https://www.drupal.org/writing-secure-code/hash-functions and share with whoever decides what hash function to use on SuperSaaS.
  2. Do not include .gitignore in the repo you push (make it ignore itself).

The starred items (*) above are big issues and warrant the application going back to Needs Work. Items marked with a plus sign (+) should be addressed before a stable project release, but does not block the project from being promoted to a full project. The rest of the comments are only recommendations.

Conclusion

There are IMHO no more blockers. Moving to RTBC. Note that promotion will not happen until a git administrator has given this a second set of eyeballs.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Apologies for the unconscionable four month delay. You are now a "vetted git user" and can promote projects to full status.

supersaas’s picture

Thank you mlncn. Really appreciated.
- Laith

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.