This module allows any user with the "invite new user" permission to send role invites to an email address. This module assumes that you are using external authentication (such as LDAP or Shibboleth) and that users receiving the invites can already log into the website. Upon receiving the invitation email, the user is directed to the user login page. Upon successful authentication, the elevated role is automatically granted.
Project page:
https://www.drupal.org/project/user_external_invite
Git clone command:
git clone --branch 7.x-1.x http://git.drupal.org/project/user_external_invite.git
Manual reviews of other projects
"Stop. Who would cross the Bridge of Death must review me these modules three, ere the full project access he see."
Module the first: https://www.drupal.org/node/2746485#comment-11621009
Module the second: https://www.drupal.org/node/2414741#comment-11623441
Module the third: https://www.drupal.org/node/2767617#comment-11623945
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | coder-results.txt | 3.33 KB | klausi |
| #18 | xss_invite_external.png | 49.65 KB | greggles |
Comments
Comment #2
afinnarn commentedComment #3
PA robot commentedWe 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.
Comment #4
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgprojectuser_external_invitegit
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #5
atul4drupal commentedHello afinnarn,
Here is what I found looking at your module.
File - user_external_invite.module
1) The submit function for user_external_invite_settings_form() is not used, so better remove it from the module.
2) Its good practice to follow every drupal_got() statement with 'exit'.
3) In _user_external_invite_pending_invites() line 232 you can do away with the "->fields('i');" in your query, apparently you are returning all columns of the record, in which case you can take off the code in line 232.
4) Write function to delete the variables defined in your module on uninstalling the module.
SUGGESTION:
1) The module looks too long in terms of the lines of code for the functionality, you can think about moving all the non hook functions to other files.
2) What will happen if say after two days I change the 'roles' that are to be assigned to the invited users in which case the users who already are invited into the system has to be updated manually (forget if the number of user's are too many).
3) You can also think of adding a permanent log of all the users who are invited and eventually accepted the invite.
Comment #6
afinnarn commentedHello @atul4drupal,
Thanks for the code review, comments, and suggestions. All good and helpful. I did have a few comments on your review of the .module file:
2) When I looked at the drupal_goto() function it eventually called 'exit' so I'm curious as to why you say that is a best practice?
3) When I removed the fields part of that query it gave me an error. I've seen that format used a lot, even on the db_query page, so I'm leaving that in.
The suggestions are all good and I'll make tickets out of those. Thanks again for the review!
Comment #7
Rahul Seth commented@afinnarn
I observe some points while reviewing your module.
package = Peopledrupal_set_title('Invite New User');
Comment #8
afinnarn commentedThanks for the points @Rahul Seth! I made those changes in the module accordingly.
Comment #9
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #10
afinnarn commentedchanged status back to needs review
Comment #11
nitinsp commentedComment #12
nitinsp commentedComment #13
vipul.patil7888 commented@afinnarn,
I was trying to know what this module does and how it is used but didn't found "hook_help()". Please add "hook_help()".
Thanks
Comment #14
braindrift commentedHi afinnarn,
1. It would be nice to have a drush alias for the command
user-external-invite-send.2. You should move the admin setting forms/page callbacks to a separate user_external_invite.admin.inc file.
3. There is no need for a separate
user_external_invite_form_accessaccess callback. Just do it like you did for the first menu item'admin/config/people/invite'Would look like:
Best regards
Comment #15
arulraj commentedAutomated Review
Looks good for me
Manual Review
1.Warning: Invalid argument supplied for foreach() in user_external_invite_form() (line 279 of sites\all\modules\user_external_invite\user_external_invite.module).
2. Notice: Undefined variable: role_options in user_external_invite_form() (line 286 of \sites\all\modules\user_external_invite\user_external_invite.module).
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.
Comment #16
klausiSounds like the PHP warnings should be fixed before we continue reviewing here, can you check @afinnarn?
Comment #17
afinnarn commentedThe PHP warnings were indicative of errors in the code, which I have fixed. Thanks all for the feedback! I did add a couple of feature-type tickets to the issue queue, but none of them are bugs, so I think the review process can continue.
@klausi, I'm moving this back to needs review, but feel free to change it back to needs work if it isn't fit for reviewing.
Thanks again everyone :)
Comment #18
gregglesA few general thoughts that definitely aren't blockers:
I noticed 2 security issues:
"><plaintext>. This issue isn't a huge problem as modifying the role to contain malicious characters requires advanced permissions.I've added the security tag to this review which we use for statistical purposes. Please leave it even after you fix the security issues.
Edited to clarify: first points definitely aren't blockers
Comment #19
haripalrao commentedHi afinnarn,
I have a few suggestions for your project:
1) Mention about passing and return parameters in your functions.
2) Use space between a line and comment for another line to understand code easily.
For Example:
//This is for $x
$x = 5
//This is for $y
$y = 10;
3) Do not need to take extra variable.
For example:
$role_name = $user_role->name;
$role_name = ucwords(str_replace('_', ' ', $role_name));
This can be done in a single line: $role_name = ucwords(str_replace('_', ' ', $user_role->name));
4) You can include mail.inc and write mail related functions in this file instead of module file.
Comment #20
afinnarn commentedThanks for the reviews @greggles and @haripalrao!
I've made most of the listed changes, except for the spaces for code readability and extra variables. A large portion of the module has spaces between lines and comments, and I think this is a minor issue. Same with extra variables. Sometimes making extra variables makes the code more readable but not a huge deal.
I made a couple tickets about splitting out the functions into separate files and adding more info to doc blocks and comments.
Comment #21
afinnarn commentedMarking back to Needs Review after addressing previous comments.
Comment #22
gregglesThanks, afinnarn, any chance you'd review 3 project applications to get the review bonus?
Comment #23
damienmckennaI was concerned that user_external_invite_pending_invites_form_submit() calls a function that's passed in from the admin form - it could have opened the door to someone with access to that page to change the form value to "user_delete_multiple" and then change the submitted values to "1" and then delete the main admin account, but Form API checks the value against what is defined for the select field's #options list and blocks the submission if the value doesn't exist. So, you *almost* had a major security problem, but yay for Form API :)
A few quick things:
@afinnarn: If you make the first change I'd be ok marking it RTBC, the others could be dealt with later.
Comment #24
gregglesFWIW, yes, Form API protects against some kinds of "semantic forgery" vulnerabilities like that.
I think another solution for point #1 is to validate them against a list of known good values (if that's possible).
Comment #25
afinnarn commentedComment #26
afinnarn commentedThanks for the comments DamienMcKenna and greggles.
Thanks for the edification on call_user_func(). That was pretty dumb to use call_user_func() that way. It was one of those, I've never used this function and want to try and find a way to use it. I removed all of the logic in that submit handler since there is only one operation that can be performed now, but I will just check the key against known operations once those are added in the future.
I also completed the lauded bonus reviews. Huzzah!
Comment #27
afinnarn commentedComment #28
klausiReview of the 7.x-1.x branch (commit a4a3aba):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual reivew:
Although you should definitely fix those issues they don't seem to be absolutely critical application blockers, otherwise RTBC. Assigning to greggles as he might have time to take a final look at this.
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #29
mlncn commentedThanks for your contribution, afinnarn! You are now a vetted Git user. You can promote this to a full project.
When you create new projects (typically as a sandbox to start) you can then promote them to a full project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. We know it's broken and are trying to fix it.
Comment #30
afinnarn commentedThanks @mlncn! I feel like this is a Drupal baptism or maybe my bar mitzvah or Quinceañera. Should this issue be marked as closed now?
Comment #31
damienmckennaComment #32
naveenvalecha