Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-13891

Remove organizations

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.7
    • Component/s: None
    • Labels:
      None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      The goal will be to remove the concept of organizations in SonarQube's code base.
      Organizations are already not in use, but we work around a "default organization".

      The work can be split in several areas, as independent as possible, between this ticket and SONAR-13903

      Authentication/Users

      We no longer need to check for user membership in an organization. Checking for permissions will only depend on the permission key, not on an organization.

      Update: AbstractUserSession, ServerUserSession and other implementations

      User registration: update UserUpdater and UserRegistrarImpl 

      WS

      • A lot of WS are impacted, since most WS check user permissions and memberships using organization. All that will have to be cleaned up once UserSessions are changed.

      DB

      • Tables 'groups', 'group_roles',  'permission_templates', 'users', and 'user_roles': Remove column 'organization_uuid'.
      • 'Name' in the table 'groups' can now be unique
      • Update AuthorizationDao, UserPermissiondao, GroupPermissionDao, PermissionTemplateDao

       

      Components

      WS

      • api/components/suggestions endpoint, organization need to be removed from the result

      DB

      • Tables 'components' and 'projects': drop column 'organization'
      • all references to components.organization_uuid, like in LiveMeasureMapper.xml

      Tests

      • A lot of utility classes will be impacted,  like ComponentDbTester and ComponentTesting. We'll have to refactor all methods using orgs.

       

      Organizations

      WS

      • All WS under organizations/ and helper classes can be removed

      DB

      • The following tables and all associated classes can be removed: 'organizations', 'organization_members' and 'organization_alm_bindings'**
      • I'm not even sure if 'organization_alm_bindings' is used at all
        • To me it's not: its used for example to synchronize membership when the feature is enabled at org level, which should never happen on SQ, so that's dead code. (MemberUpdater.java:113)

      CE

      • Storing the default organization in the AnalysisMetadata and PostProjectAnalysisTask and injecting the object DefaultOrganization in several steps is no longer needed.

      Startup task

      • A startup task should be added in order to check that only the default organization exists in DB, and fail if it's not the case.

       

      Webhook

      OrganizationWebhookHandler.java can be deleted, with related tests and package
      DB

      • Table 'webhooks': Remove column 'organization_uuid'.

      Issues

      • Issue assignment should not depend anymore on user organization membership

      Documentation

      Effect on ITs

      Everything related to OrganizationTester.java must be removed. it's used in 195 places, including:

      • branch.it.suite (11)
      • it-code.test (182)
        • authorization (4)
        • ce (8)
        • issue (22)
        • organization (58)
        • project (18)
        • qualityGate (9)
        • qualityProfile (49)
        • rule (10)
        • user (3)
        • webhook (1)

       com.sonarsource.it.Tester need to be cleaned up, removing organizations().enableSupport() and deleteOrganizations()

      Effect on UTs

      DbTester.getDefaultOrganization() is used 1419 times, mainly in webserver-web-api.test package. Usage is spread amongst component, favorite, issue, measure, metric, org, permission, project, qg, qp, rule, setting, users, webhook. Basically every SQ domains.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              duarte.meneses Duarte Meneses
              Reporter:
              duarte.meneses Duarte Meneses
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: