[1.2.x] CiviCRM Group Role Sync

Created on 19 August 2023, over 1 year ago
Updated 10 November 2023, about 1 year ago

This module provides two-way synchronization between Drupal Roles and CiviCRM Groups based on rules defined by the administrator.

Project link

https://www.drupal.org/project/civicrm_group_roles →

📌 Task
Status

Fixed

Component

module

Created by

🇮🇳India jitendrapurohit

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jitendrapurohit
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying! Reviewers will review the project files, describing what needs to be changed.

    Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

    To reviewers: Please read How to review security advisory coverage applications → , What to cover in an application review → , and Drupal.org security advisory coverage application workflow → .

    While this application is open, only the user who opened the application can make commits to the project used for the application.

    Reviewers only describe what needs to be changed; they don't provide patches to fix what reported in a review.

  • Status changed to Needs work over 1 year ago
  • 🇮🇳India vishal.kadam Mumbai

    Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml civicrm_group_roles/
    
    FILE: civicrm_group_roles/README.md
    -----------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -----------------------------------------------------------------------
     1 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
     3 | ERROR   | [x] Expected 1 newline at end of file; 2 found
    -----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/civicrm_group_roles.info.yml
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/CivicrmGroupRoles.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 48 ERRORS AND 10 WARNINGS AFFECTING 46 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
      10 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Database\Database.
      14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
      94 | ERROR   | [x] Whitespace found at end of line
     241 | WARNING | [x] 'TODO: Support smart groups.' should match the format '@todo Fix problem X here.'
     241 | ERROR   | [x] No space found before comment text; expected "// TODO: Support smart groups." but found "//TODO: Support smart groups."
     257 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     293 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     327 | ERROR   | [ ] Description for the @return value is missing
     334 | WARNING | [x] A comma should follow the last multiline array item. Found: )
     340 | ERROR   | [ ] Parameter $roles is not described in comment
     345 | ERROR   | [ ] Missing parameter name
     346 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
     368 | ERROR   | [ ] Doc comment short description must end with a full stop
     368 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
     376 | ERROR   | [x] No space found before comment text; expected "// Get groups synced with the roles." but found "//Get groups synced with the roles."
     384 | ERROR   | [x] Inline comments must start with a capital letter
     384 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     400 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     401 | ERROR   | [x] Doc comment short description must end with a full stop
     403 | ERROR   | [x] Parameter comment must be on the next line
     404 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 22 spaces
     405 | ERROR   | [x] Parameter comment must end with a full stop
     406 | ERROR   | [x] Separate the @param and @return sections by a blank line.
     406 | ERROR   | [ ] Description for the @return value is missing
     408 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     408 | ERROR   | [x] Visibility must be declared on method "validateGroups"
     409 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
     410 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     410 | ERROR   | [x] Short array syntax must be used to define arrays
     415 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     415 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     416 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     417 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     418 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     419 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     419 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     420 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     421 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     422 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     424 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
     424 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     424 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     425 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     426 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     427 | ERROR   | [x] Line indented incorrectly; expected 12 spaces, found 8
     428 | ERROR   | [x] Line indented incorrectly; expected 12 spaces, found 8
     429 | ERROR   | [x] Line indented incorrectly; expected 12 spaces, found 8
     429 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     430 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     431 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     432 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 6
     433 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
     434 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
     435 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
     436 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     436 | ERROR   | [x] Expected 1 blank line after function; 2 found
     472 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
     494 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 45 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/Form/SettingsForm.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     10 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/Form/ManualSyncForm.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/Form/CivicrmGroupRoleRuleForm.php
    ---------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------------------
     13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
     23 | ERROR   | [ ] Missing short description in doc comment
     24 | ERROR   | [x] Do not append variable name "$messenger" to the type declaration in a member variable comment
     28 | ERROR   | [ ] Parameter $messenger is not described in comment
     60 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/Entity/CivicrmGroupRoleRuleInterface.php
    ------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------
     33 | ERROR | Description for the @return value is missing
     40 | ERROR | Missing parameter comment
    ------------------------------------------------------------------------------------------------------
    
    
    FILE: civicrm_group_roles/src/Batch/Sync.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
    ---------------------------------------------------------------------------------------------------------------------------
       8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Database\Database.
      12 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
      17 | ERROR   | [ ] Missing short description in doc comment
      18 | ERROR   | [x] Do not append variable name "$messenger" to the type declaration in a member variable comment
      22 | ERROR   | [ ] Parameter $messenger is not described in comment
     113 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     130 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India jitendrapurohit

    Fixed the issues returned by phpcs.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review → gives some hints for a smother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications → , Application workflow → , What to cover in an application review → , and Tools to use for reviews → .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool → only once per application.
    • It may be best to have the applicant fix things before further review.
    • Reviewer's task is describing what needs to be changed, not providing patches to fix what reported in a review.
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India vishal.kadam Mumbai

    Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml civicrm_group
    _roles/
    
    FILE:civicrm_group_roles/src/CivicrmGroupRoles.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
     257 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     293 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     429 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     440 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     504 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------
    
    
    FILE:civicrm_group_roles/src/Form/CivicrmGroupRoleRuleForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     64 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------
    
    
    FILE:civicrm_group_roles/src/Batch/Sync.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     117 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     134 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------
    
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    @vishal.kadam Please show the PHP_CodeSniffer report only once per application. If there are still warnings/errors that should be fixed, it is sufficient to describe what needs to be changed, instead of quoting again the report given by PHP_CodeSniffer.

  • 🇮🇳India vishal.kadam Mumbai

    @apaderno Thanks for your guidance. I've updated my comment #7 → .

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India jitendrapurohit

    Fixed the warnings regarding dependency injection.

  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for other reviewers to take a look and if everything goes fine, you will get the role.

  • Status changed to Needs work over 1 year ago
  • 🇮🇳India vinaymahale

    Reviewed and found there's another error from PHPCS pending to be fixed
    Please review below:

    FILE: /civicrm_group_roles/src/CivicrmGroupRoles.php
    -------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------
     366 | ERROR | Type hint "array" missing for $roles
    -------------------------------------------------------------------------------------------
    
  • Status changed to Needs review over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Is there anything else that needs to be changed? A single missing type hinting is not sufficient to change status.

  • 🇮🇳India vinaymahale

    Apart from the type hinting others looks good to me. Lets wait for other reviewers!

  • Reviewed, the code looks good besides the warning mentioned at #12

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India vinaymahale

    No issues found
    Changing status to RTBC!

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    • What follows is a quick review of the project; it doesn't mean to be complete
    • For each point, the review usually shows some lines that should be fixed (except in the case the point is about the full content of a file); it doesn't show all the lines that need to be changed for the same reason
    • A review is about code that doesn't follow the coding standards, contains possible security issue, or doesn't correctly use the Drupal API; the single points aren't ordered, not even by importance

    src/Form/CivicrmGroupRoleRuleDeleteForm.php

        \Drupal::messenger()->addMessage($this->t('Deleted association rule @label.', ['@label' => $this->entity->label()]));
    

    Every dependency must be injected in the create() method.

    src/Form/SettingsForm.php

        $config = $this->config('civicrm_group_roles.settings');
        $config->set('debugging', $form_state->getValue('debugging'));
        $config->save();
    

    (As a side note) Chaining method calls is possible, with the object stored in $config.
    (As a side note)

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India jitendrapurohit

    I've fixed the above mentioned issues with messenger service and method chaining. Can anyone please retest this?

    Thanks.

  • 🇮🇳India jitendrapurohit

    Any update on this please? We're looking to release the d10 version with this ticket included.

  • Status changed to RTBC about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for your contribution! I am going to update your account.

    These are some recommended readings to help with excellent maintainership:

    You can find more contributors chatting on the Slack → #contribute channel. So, come hang out and stay involved → .
    Thank you, 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.

    I thank all the reviewers.

  • Status changed to Fixed about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Assigned to apaderno
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024