Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrate Tenant to Organization #38891

Merged
merged 29 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fe2dd17
First round of refactor to rename tenant to organization
trishaanand Jan 29, 2025
b610564
Second round of refactor in function and variable names
trishaanand Jan 29, 2025
0ba73c6
Fixing failing test cases by updating the string match for 404
trishaanand Jan 29, 2025
8a3cf33
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Jan 31, 2025
4d4e8ab
WIP : Untested code
trishaanand Jan 31, 2025
6c1df19
Fixed compilation error.
trishaanand Feb 5, 2025
12ada21
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Feb 5, 2025
656bdd8
Updating the redis migration to solve for deserialization error. Unte…
trishaanand Feb 6, 2025
479dbf6
Migrated the caches. Testing pending for caches
trishaanand Feb 6, 2025
bf2969c
Reverting FeatureRequestDTO till CS implements these changes
trishaanand Feb 6, 2025
9008f1e
Setting organizationId for all the users created for tests
trishaanand Feb 6, 2025
ecb9c9a
Fixing the migrations of existing domain objects.
trishaanand Feb 6, 2025
4f8192e
Client side changes
trishaanand Feb 7, 2025
0fffaf2
Fixed the failing test case.
trishaanand Feb 7, 2025
602d4e0
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Feb 7, 2025
9cc5724
Updated the remaining files except ACL Permissions
trishaanand Feb 7, 2025
db3899a
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Feb 10, 2025
4b9753e
Undoing Migration file changes. And adding back deprecated Tenant.
trishaanand Feb 10, 2025
d5d4a95
Moving update super user migration outside of DatabaseChangelog2 to e…
trishaanand Feb 10, 2025
2620952
Fixing failing test
trishaanand Feb 11, 2025
647e6c5
Adding empty function changes to override in EE
trishaanand Feb 11, 2025
a35fa05
Updated the enum name for tenant permission. Permission string name t…
trishaanand Feb 11, 2025
2034b20
Updated the migration to also cater to updating the policy with the n…
trishaanand Feb 11, 2025
c2783f0
Adding older enums back with @Deprecated enum so that the objects are…
trishaanand Feb 13, 2025
7de5d2b
Fixing EE branding spec cypress test failure
trishaanand Feb 17, 2025
1a143a2
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Feb 17, 2025
e14f1dd
Merge branch 'release' into chore/migrate-tenant-organization
trishaanand Feb 18, 2025
30ac4b0
Fixing compile time errors with the new release commits
trishaanand Feb 18, 2025
d30db44
Spotless changes
trishaanand Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/client/src/ce/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import SignupSuccess from "pages/setup/SignupSuccess";
import type { ERROR_CODES } from "ee/constants/ApiConstants";
import TemplatesListLoader from "pages/Templates/loader";
import { getCurrentUser as getCurrentUserSelector } from "selectors/usersSelectors";
import { getTenantPermissions } from "ee/selectors/tenantSelectors";
import { getOrganizationPermissions } from "ee/selectors/organizationSelectors";
import useBrandingTheme from "utils/hooks/useBrandingTheme";
import RouteChangeListener from "RouteChangeListener";
import { initCurrentPage } from "../actions/initActions";
Expand All @@ -71,7 +71,7 @@ export const loadingIndicator = <PageLoadingBar />;

export function Routes() {
const user = useSelector(getCurrentUserSelector);
const tenantPermissions = useSelector(getTenantPermissions);
const organizationPermissions = useSelector(getOrganizationPermissions);
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);

useFeatureFlagOverride();
Expand Down Expand Up @@ -102,7 +102,7 @@ export function Routes() {
: getAdminSettingsPath(
isFeatureEnabled,
user?.isSuperUser || false,
tenantPermissions,
organizationPermissions,
)
}
/>
Expand Down Expand Up @@ -161,7 +161,7 @@ export default function AppRouter() {

const isLoading = isConsolidatedPageLoading;

// hide the top loader once the tenant is loaded
// hide the top loader once the organization is loaded
useEffect(() => {
if (!isLoading) {
const loader = document.getElementById("loader") as HTMLDivElement;
Expand Down
21 changes: 21 additions & 0 deletions app/client/src/ce/actions/organizationActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type { UpdateOrganizationConfigRequest } from "ee/api/OrganizationApi";
import type { ApiResponse } from "api/ApiResponses";

export const getCurrentOrganization = (
isBackgroundRequest = true,
organizationConfig?: ApiResponse,
) => ({
type: ReduxActionTypes.FETCH_CURRENT_ORGANIZATION_CONFIG,
payload: {
isBackgroundRequest,
organizationConfig,
},
});

export const updateOrganizationConfig = (
payload: UpdateOrganizationConfigRequest,
) => ({
type: ReduxActionTypes.UPDATE_ORGANIZATION_CONFIG,
payload,
});
19 changes: 0 additions & 19 deletions app/client/src/ce/actions/tenantActions.ts

This file was deleted.

46 changes: 46 additions & 0 deletions app/client/src/ce/api/OrganizationApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { AxiosPromise, AxiosRequestConfig } from "axios";

import Api from "api/Api";
import type { ApiResponse } from "api/ApiResponses";

export type FetchCurrentOrganizationConfigResponse = ApiResponse<{
userPermissions: string[];
organizationConfiguration: Record<string, string>;
new: boolean;
}>;

export type UpdateOrganizationConfigResponse = ApiResponse<{
organizationConfiguration: Record<string, string>;
}>;

export interface UpdateOrganizationConfigRequest {
organizationConfiguration: Record<string, string>;
needsRefresh?: boolean;
isOnlyOrganizationSettings?: boolean;
apiConfig?: AxiosRequestConfig;
}

export class OrganizationApi extends Api {
static tenantsUrl = "v1/tenants";

static async fetchCurrentOrganizationConfig(): Promise<
AxiosPromise<FetchCurrentOrganizationConfigResponse>
> {
return Api.get(`${OrganizationApi.tenantsUrl}/current`);
}

static async updateOrganizationConfig(
request: UpdateOrganizationConfigRequest,
): Promise<AxiosPromise<UpdateOrganizationConfigResponse>> {
return Api.put(
`${OrganizationApi.tenantsUrl}`,
request.organizationConfiguration,
null,
{
...(request.apiConfig || {}),
},
);
}
}

export default OrganizationApi;
46 changes: 0 additions & 46 deletions app/client/src/ce/api/TenantApi.ts

This file was deleted.

24 changes: 13 additions & 11 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1193,19 +1193,21 @@ const AppSettingsActionTypes = {
"UPDATE_APP_SETTINGS_PANE_SELECTED_TAB",
};

const TenantActionTypes = {
FETCH_CURRENT_TENANT_CONFIG: "FETCH_CURRENT_TENANT_CONFIG",
FETCH_CURRENT_TENANT_CONFIG_SUCCESS: "FETCH_CURRENT_TENANT_CONFIG_SUCCESS",
UPDATE_TENANT_CONFIG: "UPDATE_TENANT_CONFIG",
UPDATE_TENANT_CONFIG_SUCCESS: "UPDATE_TENANT_CONFIG_SUCCESS",
const OrganizationActionTypes = {
FETCH_CURRENT_ORGANIZATION_CONFIG: "FETCH_CURRENT_ORGANIZATION_CONFIG",
FETCH_CURRENT_ORGANIZATION_CONFIG_SUCCESS:
"FETCH_CURRENT_ORGANIZATION_CONFIG_SUCCESS",
UPDATE_ORGANIZATION_CONFIG: "UPDATE_ORGANIZATION_CONFIG",
UPDATE_ORGANIZATION_CONFIG_SUCCESS: "UPDATE_ORGANIZATION_CONFIG_SUCCESS",
FETCH_PRODUCT_ALERT_INIT: "FETCH_PRODUCT_ALERT_INIT",
FETCH_PRODUCT_ALERT_SUCCESS: "FETCH_PRODUCT_ALERT_SUCCESS",
UPDATE_PRODUCT_ALERT_CONFIG: "UPDATE_PRODUCT_ALERT_CONFIG",
};

const TenantActionErrorTypes = {
FETCH_CURRENT_TENANT_CONFIG_ERROR: "FETCH_CURRENT_TENANT_CONFIG_ERROR",
UPDATE_TENANT_CONFIG_ERROR: "UPDATE_TENANT_CONFIG_ERROR",
const OrganizationActionErrorTypes = {
FETCH_CURRENT_ORGANIZATION_CONFIG_ERROR:
"FETCH_CURRENT_ORGANIZATION_CONFIG_ERROR",
UPDATE_ORGANIZATION_CONFIG_ERROR: "UPDATE_ORGANIZATION_CONFIG_ERROR",
FETCH_PRODUCT_ALERT_FAILED: "FETCH_PRODUCT_ALERT_FAILED",
};

Expand Down Expand Up @@ -1286,7 +1288,7 @@ export const ReduxActionTypes = {
...SnippingModeActionTypes,
...TableWidgetActionsTypes,
...TemplateActionsTypes,
...TenantActionTypes,
...OrganizationActionTypes,
...ThemeActionTypes,
...UserAuthActionTypes,
...UserProfileActionTypes,
Expand Down Expand Up @@ -1316,7 +1318,7 @@ export const ReduxActionErrorTypes = {
...PlatformActionErrorTypes,
...PluginActionErrorTypes,
...TemplateActionErrorTypes,
...TenantActionErrorTypes,
...OrganizationActionErrorTypes,
...UserAuthActionErrorTypes,
...UserProfileActionErrorTypes,
...WidgetCanvasActionErrorTypes,
Expand All @@ -1332,7 +1334,7 @@ export const toastMessageErrorTypes = {
...GitActionErrorTypes,
...ImportExportActionErrorTypes,
...PlatformActionErrorTypes,
...TenantActionErrorTypes,
...OrganizationActionErrorTypes,
...UserAuthActionErrorTypes,
...UserProfileActionErrorTypes,
...WorkspaceActionErrorTypes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const tenantConfigConnection: string[] = [
export const organizationConfigConnection: string[] = [
"instanceName",
"googleMapsKey",
"emailVerificationEnabled",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useSelector } from "react-redux";
import {
getThirdPartyAuths,
getIsFormLoginEnabled,
} from "ee/selectors/tenantSelectors";
} from "ee/selectors/organizationSelectors";
import {
FORM_LOGIN_DESC,
GITHUB_AUTH_DESC,
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/ce/pages/AdminSettings/config/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const APPSMITH_IS_ATOMIC_PUSH_ALLOWED: Setting = {
category: SettingCategories.GENERAL,
controlType: SettingTypes.CHECKBOX,
label: "Allow atomic pushes",
text: "Git operations on this tenant should attempt to perform pushes atomically",
text: "Git operations on this organization should attempt to perform pushes atomically",
};

export const APPSMITH_ALLOWED_FRAME_ANCESTORS_SETTING: Setting = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jest.mock("selectors/gitModSelectors", () => ({

const defaultStoreState = {
...unitTestBaseMockStore,
tenant: {
tenantConfiguration: {},
organization: {
organizationConfiguration: {},
},
entities: {
...unitTestBaseMockStore.entities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { fetchMockDatasources } from "actions/datasourceActions";
import DatasourceForm from "pages/Editor/SaaSEditor/DatasourceForm";
import type { Datasource } from "entities/Datasource";
import { fetchingEnvironmentConfigs } from "ee/actions/environmentAction";
import { shouldShowLicenseBanner } from "ee/selectors/tenantSelectors";
import { shouldShowLicenseBanner } from "ee/selectors/organizationSelectors";
import { isAirgapped } from "ee/utils/airgapHelpers";

const SectionWrapper = styled.div<{ isBannerVisible: boolean }>`
Expand Down
8 changes: 4 additions & 4 deletions app/client/src/ce/pages/Applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ import {
getIsFetchingApplications,
} from "ee/selectors/selectedWorkspaceSelectors";
import {
getTenantPermissions,
getOrganizationPermissions,
shouldShowLicenseBanner,
} from "ee/selectors/tenantSelectors";
} from "ee/selectors/organizationSelectors";
import { getWorkflowsList } from "ee/selectors/workflowSelectors";
import {
getFetchedWorkspaces,
Expand Down Expand Up @@ -301,12 +301,12 @@ export function LeftPaneSection(props: {
}) {
const dispatch = useDispatch();
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const tenantPermissions = useSelector(getTenantPermissions);
const organizationPermissions = useSelector(getOrganizationPermissions);
const fetchedWorkspaces = useSelector(getFetchedWorkspaces);

const canCreateWorkspace = getHasCreateWorkspacePermission(
isFeatureEnabled,
tenantPermissions,
organizationPermissions,
);

const createNewWorkspace = async () => {
Expand Down
8 changes: 4 additions & 4 deletions app/client/src/ce/reducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import SettingsReducer from "ee/reducers/settingsReducer";
import type { TriggerValuesEvaluationState } from "reducers/evaluationReducers/triggerReducer";
import type { CanvasWidgetStructure } from "WidgetProvider/constants";
import type { AppSettingsPaneReduxState } from "reducers/uiReducers/appSettingsPaneReducer";
import type { TenantReduxState } from "ee/reducers/tenantReducer";
import tenantReducer from "ee/reducers/tenantReducer";
import type { OrganizationReduxState } from "ee/reducers/organizationReducer";
import organizationReducer from "ee/reducers/organizationReducer";
import type { FocusHistoryState } from "reducers/uiReducers/focusHistoryReducer";
import type { EditorContextState } from "ee/reducers/uiReducers/editorContextReducer";
import type { LibraryState } from "reducers/uiReducers/libraryReducer";
Expand Down Expand Up @@ -87,7 +87,7 @@ export const reducerObject = {
evaluations: evaluationsReducer,
form: formReducer,
settings: SettingsReducer,
tenant: tenantReducer,
organization: organizationReducer,
linting: lintErrorReducer,
git: gitReducer,
};
Expand Down Expand Up @@ -180,7 +180,7 @@ export interface AppState {
settings: SettingsReduxState;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tenant: TenantReduxState<any>;
organization: OrganizationReduxState<any>;
git: {
global: GitGlobalReduxState;
artifacts: GitArtifactRootReduxState;
Expand Down
Loading
Loading