chore: Removing the hook for create actions permission (#39470)
## Description Removing the hook for create actions permission as its no longer required. Fixes [#39035](https://github.com/appsmithorg/appsmith/issues/39035) ## Automation /ok-to-test tags="@tag.Datasource, @tag.JS" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13561142790> > Commit: 7a64f7b2c2a68c03d8fe91f935b2ba7643626f4e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13561142790&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Datasource, @tag.JS` > Spec: > <hr>Thu, 27 Feb 2025 08:40:44 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated the logic for evaluating permissions when creating actions within the Integrated Development Environment. - Replaced the previous approach with a refined method that combines feature flag checks and current page permissions for more granular and consistent user access control. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
7aabb93c1c
commit
4b2a420028
|
|
@ -1,20 +0,0 @@
|
|||
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
||||
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";
|
||||
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
|
||||
import { useSelector } from "react-redux";
|
||||
import { getPagePermissions } from "selectors/editorSelectors";
|
||||
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
|
||||
|
||||
export const useCreateActionsPermissions = (ideType: IDEType) => {
|
||||
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
||||
const pagePermissions = useSelector(getPagePermissions);
|
||||
|
||||
switch (ideType) {
|
||||
case IDE_TYPE.App: {
|
||||
return getHasCreateActionPermission(isFeatureEnabled, pagePermissions);
|
||||
}
|
||||
default: {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export { useCreateActionsPermissions } from "ce/entities/IDE/hooks/useCreateActionsPermissions";
|
||||
|
|
@ -23,9 +23,10 @@ import { filterEntityGroupsBySearchTerm } from "IDE/utils";
|
|||
import { useLocation } from "react-router";
|
||||
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
|
||||
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
|
||||
import { useCreateActionsPermissions } from "ee/entities/IDE/hooks/useCreateActionsPermissions";
|
||||
import { JSEntity } from "ee/pages/AppIDE/components/JSListItem/ListItem";
|
||||
import type { EntityItem } from "ee/IDE/Interfaces/EntityItem";
|
||||
import { getPagePermissions } from "selectors/editorSelectors";
|
||||
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
|
||||
|
||||
const JSContainer = styled(Flex)`
|
||||
& .t--entity-item {
|
||||
|
|
@ -42,7 +43,12 @@ export const ListJSObjects = () => {
|
|||
const location = useLocation();
|
||||
const ideType = getIDETypeByUrl(location.pathname);
|
||||
const { editorId, parentEntityId } = useParentEntityInfo(ideType);
|
||||
const canCreateActions = useCreateActionsPermissions(ideType);
|
||||
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
||||
const pagePermissions = useSelector(getPagePermissions);
|
||||
const canCreateActions = getHasCreateActionPermission(
|
||||
isFeatureEnabled,
|
||||
pagePermissions,
|
||||
);
|
||||
|
||||
const isNewADSTemplatesEnabled = useFeatureFlag(
|
||||
FEATURE_FLAG.release_ads_entity_item_enabled,
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ import { ActionEntityItem } from "ee/pages/AppIDE/components/QueryEntityItem/Lis
|
|||
import { useLocation } from "react-router";
|
||||
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
|
||||
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
|
||||
import { useCreateActionsPermissions } from "ee/entities/IDE/hooks/useCreateActionsPermissions";
|
||||
import { objectKeys } from "@appsmith/utils";
|
||||
import type { EntityItem } from "ee/IDE/Interfaces/EntityItem";
|
||||
import { getPagePermissions } from "selectors/editorSelectors";
|
||||
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
|
||||
|
||||
export const ListQuery = () => {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
|
|
@ -36,7 +37,12 @@ export const ListQuery = () => {
|
|||
const location = useLocation();
|
||||
const ideType = getIDETypeByUrl(location.pathname);
|
||||
const { editorId, parentEntityId } = useParentEntityInfo(ideType);
|
||||
const canCreateActions = useCreateActionsPermissions(ideType);
|
||||
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
||||
const pagePermissions = useSelector(getPagePermissions);
|
||||
const canCreateActions = getHasCreateActionPermission(
|
||||
isFeatureEnabled,
|
||||
pagePermissions,
|
||||
);
|
||||
|
||||
const showWorkflows = useSelector(getShowWorkflowFeature);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user