PromucFlow_constructor/app/server/scripts/node
Ankita Kinger 3933f5f4d1
feat: migrate from org to workspace under phase 3 (#14158)
* migration from organization to workspace on code level

* updated a few more files

* fixed runtime errors

* update org settings URL

* Renamed organizationId in domain objects

* changed field named from organization to workspace

* Reverted AppsmithRole changes

* fixed migrations

* recreating indexes

* migration update

* seed data runs before migration, undo changes

* mock commit

* seedmongo to populate upgraded data, datasource upgrade

* fixed two test cases

* updated migrations

* updated prop name

* Upgraded AclPermission

* comment

* migrated AppsmithRole

* more changes

* final set of changes

* variable name changes

* update cypress variable name

* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java

* Update app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/Datasource.java

Co-authored-by: Trisha Anand <trisha@appsmith.com>

* reverting encryption handler change

* refactor code to migrate from org to workspace

* migrated a few missed out org to workspace

* updated a few more

* migrated a few missed out org to workspace

* migration changes

* Removed Permission import

* reverted code change

* few more changes

* fixed failing cypress test

* fixed failing cypress test

Co-authored-by: Sidhant Goel <sidhant@appsmith.com>
Co-authored-by: Trisha Anand <trisha@appsmith.com>
Co-authored-by: Sidhant Goel <sidhant@hexcod.in>
2022-07-20 17:24:16 +05:30
..
.editorconfig Add a node.js script to dump examples organization (#448) 2020-09-02 17:15:55 +05:30
acl-migration.js chore: Fixing yoda conditions in the code (#8297) 2021-10-08 22:21:24 +05:30
dump-examples-org.js chore: Replace equality and inequality operators with their strict versions (#7585) 2022-02-03 09:42:38 +05:30
package-lock.json chore: bump follow-redirects in /app/server/scripts/node (#12038) 2022-03-24 15:47:11 +05:30
package.json chore(deps-dev): bump axios in /app/server/scripts/node (#7318) 2021-09-09 22:14:58 +05:30
README.md feat: migrate from org to workspace under phase 3 (#14158) 2022-07-20 17:24:16 +05:30

ACL Migration Steps

  1. Create a super user (with email superuser_acl@appsmith.com), using the sign-up API.

  2. Add manage and read permissions for workspaces, applications, pages and actions for this super user, on ALL existing documents (in corresponding collections). Once this is done, the policies field of workspaces, for example, should look something like:

{
    "policies": [         
        {
            "permission" : "manage:workspaces",
            "users" : [ 
                "superuser_acl@appsmith.com"
            ],
            "groups" : []
        }, 
        {
            "permission" : "read:workspaces",
            "users" : [ 
                "superuser_acl@appsmith.com"
            ],
            "groups" : []
        }
    ]
}
  1. Disable emails for invite API actions.

  2. For each user, for each workspace in the user's workspaceIds list, hit the invite user API for that workspace, using session of the super user.

  3. Remove super user from the workspace policies, without disturbing other permission values.

  4. Remove super user from users collection.

Running

Assuming you have node (>=v12), use the following command to run the migration:

npm install
node acl-migration.js 'https://localhost/api/v1/' 'mongodb://localhost:27017/mobtools'

The first argument should be a running API endpoint, and the second argument should be a URI to the database that this API endpoint is running on.