Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-5320

create a migration script to make permission names/resp names unique

    Details

    • Type: Task Task
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-b1, 2.0
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-4803Add unique constraint on KIM permission namespace:name
      KULRICE-1495Migrate create project script
      KULRICE-3068Create scripts to migrate from old KEW user and workgroup data to KIM for 0.9.3 to 1.0 upgrade
      KULRICE-13824Identify Smoke Test that create unique names, ids, etc. things that make them fail when run a second time add ITUtil.createUniqueDtsPlusTwoRandomChars to them
      KULRICE-8854Permission doc creating a duplicate permission can be submitted but routes to exception
      KULRICE-7000Permission and Responsibility NamespaceCode+Name must be unique but the maintenance documents do not check this
      KULRICE-7267Rice upgrade scripts will not work with "real" data
      KULRICE-2067Copying without changing the name (or other Unique Constraint fields) seems to allow for submission but actually throws a unique constraint
      KULRICE-6544PermissionService.isAuthorized, hasPermission, getPermissionAssignees, and getAuthorizedPermissions no longer needs to take permission details since permission namespace + name are now unique
      KULRICE-8673Copy Permission not validating New Copy for duplicate Permission Name
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required

      Description

      [8:24:11 PM] Travis Schneeberger: now all our permissions & responsibilities have unique names & constraints to enforce things
      [8:24:48 PM | Edited 8:25:19 PM] Travis Schneeberger: I did not create an automated script to create the names from the attributes because the names would have been ridiculous

      [8:27:02 PM] Travis Schneeberger: btw. I'm not sure if we even want to create a script to gen perm/resp names for upgrade purposes b/c the script would create equally bad names
      [8:27:29 PM] Travis Schneeberger: names that you would never want to refer to in code

      [8:28:05 PM | Edited 8:28:13 PM] Jeremy Hanson: why don't we create a script that would generate a .sql document with best guesses?
      [8:28:24 PM] Jeremy Hanson: then institutions could edit that before updating
      [8:28:25 PM] Travis Schneeberger: I'll create a jira for that 'cause it doesn't have to get done now

        Issue Links

          Activity

          Hide
          Aaron Hamid (Inactive) added a comment - - edited

          Any thoughts/preferences on how this should be done? The most straightforward would be to just append the existing primary key to the name of duplicate records. I see these objects are associated with "details" records. Given there is a limit to name length, I wonder how much human-readable information we could reasonably cram into the name.

          Show
          Aaron Hamid (Inactive) added a comment - - edited Any thoughts/preferences on how this should be done? The most straightforward would be to just append the existing primary key to the name of duplicate records. I see these objects are associated with "details" records. Given there is a limit to name length, I wonder how much human-readable information we could reasonably cram into the name.
          Hide
          Aaron Hamid (Inactive) added a comment -

          I added 4 sql scripts to the scripts/upgrades/1.0.3 to 2.0.0/support dir with queries which will simply append the role or permission id to the name of any record with duplicate nmspc/nm values

          Show
          Aaron Hamid (Inactive) added a comment - I added 4 sql scripts to the scripts/upgrades/1.0.3 to 2.0.0/support dir with queries which will simply append the role or permission id to the name of any record with duplicate nmspc/nm values
          Hide
          Rice-CI User (Inactive) added a comment -

          Integrated in rice-trunk-nightly #231 (See http://ci.rice.kuali.org/job/rice-trunk-nightly/231/)
          Merge branch 'KULRICE-5320'

          Show
          Rice-CI User (Inactive) added a comment - Integrated in rice-trunk-nightly #231 (See http://ci.rice.kuali.org/job/rice-trunk-nightly/231/ ) Merge branch ' KULRICE-5320 ' KULRICE-5320 : KULRICE-5320 added sql scripts to uniquify permission and role nmspc/nm fields
          Hide
          Aaron Hamid (Inactive) added a comment - - edited

          given connection string to db, find duplicate permission and responsibility records and generate sample sql update statements - perhaps make this a generalized database report/update tool

          Show
          Aaron Hamid (Inactive) added a comment - - edited given connection string to db, find duplicate permission and responsibility records and generate sample sql update statements - perhaps make this a generalized database report/update tool
          Hide
          Aaron Hamid (Inactive) added a comment -

          Added scripts/upgrades/1.0.3 to 2.0.0/support/DbUpdateTool.groovy and supporting scripts under lib/.

          This script loads sub-scripts which can be added under lib/.

          Example usage:

          [aaron@msi-cr620 1.0.3 to 2.0.0]$ java -classpath /home/aaron/.m2/repository/com/oracle/ojdbc14/10.2.0.3.0/ojdbc14-10.2.0.3.0.jar:/home/aaron/.m2/repository/org/codehaus/groovy/groovy-all/1.8.1/groovy-all-1.8.1.jar groovy.ui.GroovyMain support/DbUpdateTool.groovy jdbc:oracle:thin:@localhost:1521:xe rice2 rice2 PermissionsNamespaceNameUniquifier
          Loading command ResponsibilityNamespaceNameUniquifier
          Loading command PermissionsNamespaceNameUniquifier
          java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
          Executing:
          select * from KRIM_PERM_T where (NMSPC_CD,NM) in (
          select NMSPC_CD,NM from KRIM_PERM_T group by NMSPC_CD,NM having count > 1
          )

          Generating transformation SQL:

          update KRIM_PERM_T set NM='Add Message to Route Log 842' where PERM_ID='842';
          update KRIM_PERM_T set NM='Add Message to Route Log 843' where PERM_ID='843';
          update KRIM_PERM_T set NM='Add Message to Route Log 844' where PERM_ID='844';
          update KRIM_PERM_T set NM='Add Message to Route Log 845' where PERM_ID='845';
          update KRIM_PERM_T set NM='Add Message to Route Log 841' where PERM_ID='841';

          Done.

          Show
          Aaron Hamid (Inactive) added a comment - Added scripts/upgrades/1.0.3 to 2.0.0/support/DbUpdateTool.groovy and supporting scripts under lib/. This script loads sub-scripts which can be added under lib/. Example usage: [aaron@msi-cr620 1.0.3 to 2.0.0] $ java -classpath /home/aaron/.m2/repository/com/oracle/ojdbc14/10.2.0.3.0/ojdbc14-10.2.0.3.0.jar:/home/aaron/.m2/repository/org/codehaus/groovy/groovy-all/1.8.1/groovy-all-1.8.1.jar groovy.ui.GroovyMain support/DbUpdateTool.groovy jdbc:oracle:thin:@localhost:1521:xe rice2 rice2 PermissionsNamespaceNameUniquifier Loading command ResponsibilityNamespaceNameUniquifier Loading command PermissionsNamespaceNameUniquifier java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Executing: select * from KRIM_PERM_T where (NMSPC_CD,NM) in ( select NMSPC_CD,NM from KRIM_PERM_T group by NMSPC_CD,NM having count > 1 ) Generating transformation SQL: update KRIM_PERM_T set NM='Add Message to Route Log 842' where PERM_ID='842'; update KRIM_PERM_T set NM='Add Message to Route Log 843' where PERM_ID='843'; update KRIM_PERM_T set NM='Add Message to Route Log 844' where PERM_ID='844'; update KRIM_PERM_T set NM='Add Message to Route Log 845' where PERM_ID='845'; update KRIM_PERM_T set NM='Add Message to Route Log 841' where PERM_ID='841'; Done.
          Hide
          Rice-CI User (Inactive) added a comment -

          Integrated in rice-trunk-nightly #232 (See http://ci.rice.kuali.org/job/rice-trunk-nightly/232/)
          Merge branch 'KULRICE-5320'

          Show
          Rice-CI User (Inactive) added a comment - Integrated in rice-trunk-nightly #232 (See http://ci.rice.kuali.org/job/rice-trunk-nightly/232/ ) Merge branch ' KULRICE-5320 ' KULRICE-5320 : KULRICE-5320 some fixes and docs Merge branch ' KULRICE-5320 ' KULRICE-5320 : KULRICE-5320 remove sql scripts KULRICE-5320 added groovy script that emits sql to uniquify permissions and responsibilities
          Hide
          Jessica Coltrin (Inactive) added a comment -

          Closing since these items are now in the release notes.

          Show
          Jessica Coltrin (Inactive) added a comment - Closing since these items are now in the release notes.

            People

            • Assignee:
              Aaron Hamid (Inactive)
              Reporter:
              Travis Schneeberger
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Remaining Estimate - 3 days
                3d
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Structure Helper Panel