Skip to content

Commit 5f482c8

Browse files
fix: access throughout dashboard (#8824)
1 parent b91b99f commit 5f482c8

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

packages/app/src/app/pages/Dashboard/Components/Folder/FolderCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const FolderCard: React.FC<FolderItemComponentProps> = ({
3737
'data-selection-id': dataSelectionId,
3838
...props
3939
}) => {
40-
const { isTeamEditor } = useWorkspaceAuthorization();
40+
const { hasEditorAccess } = useWorkspaceAuthorization();
4141

4242
return (
4343
<InteractiveOverlay>
@@ -48,7 +48,7 @@ export const FolderCard: React.FC<FolderItemComponentProps> = ({
4848
>
4949
<Stack justify="space-between">
5050
<Icon size={20} name="folder" color="#E3FF73" />
51-
{!isNewFolder && isTeamEditor ? (
51+
{!isNewFolder && hasEditorAccess ? (
5252
<IconButton
5353
css={{
5454
marginRight: '-4px',

packages/app/src/app/pages/Dashboard/Components/Folder/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Folder = (folderItem: DashboardFolder) => {
1919
const {
2020
dashboard: { renameFolder },
2121
} = useActions();
22-
const { isTeamEditor } = useWorkspaceAuthorization();
22+
const { hasEditorAccess } = useWorkspaceAuthorization();
2323

2424
const {
2525
name = '',
@@ -95,7 +95,7 @@ export const Folder = (folderItem: DashboardFolder) => {
9595

9696
/* Drop target logic */
9797

98-
const accepts = isTeamEditor ? ['sandbox'] : [];
98+
const accepts = hasEditorAccess ? ['sandbox'] : [];
9999

100100
const [{ isOver, canDrop }, dropRef] = useDrop({
101101
accept: accepts,
@@ -114,7 +114,7 @@ export const Folder = (folderItem: DashboardFolder) => {
114114

115115
const [, dragRef, preview] = useDrag({
116116
item: folderItem,
117-
canDrag: isTeamEditor,
117+
canDrag: hasEditorAccess,
118118
end: (item, monitor) => {
119119
const dropResult = monitor.getDropResult();
120120

@@ -127,7 +127,7 @@ export const Folder = (folderItem: DashboardFolder) => {
127127

128128
const dragProps = {
129129
ref: dragRef,
130-
onDragStart: isTeamEditor ? (event => onDragStart(event, path, 'folder')) : undefined,
130+
onDragStart: hasEditorAccess ? (event => onDragStart(event, path, 'folder')) : undefined,
131131
};
132132

133133
React.useEffect(() => {
@@ -188,7 +188,7 @@ export const Folder = (folderItem: DashboardFolder) => {
188188
onClick,
189189
onDoubleClick,
190190
// edit mode
191-
editing: isRenaming && selected && isTeamEditor,
191+
editing: isRenaming && selected && hasEditorAccess,
192192
isNewFolder: false,
193193
isDragging,
194194
newName,

packages/app/src/app/pages/Dashboard/Components/Header/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const Header = ({
3636
const location = useLocation();
3737
const { modalOpened, dashboard: dashboardActions } = useActions();
3838
const { dashboard } = useAppState();
39-
const { isTeamEditor } = useWorkspaceAuthorization();
39+
const { hasEditorAccess } = useWorkspaceAuthorization();
4040

4141
const repositoriesListPage =
4242
location.pathname.includes('/repositories') &&
@@ -70,7 +70,7 @@ export const Header = ({
7070
)}
7171
</Stack>
7272
<Stack gap={1} align="center">
73-
{location.pathname.includes('/sandboxes') && isTeamEditor && (
73+
{location.pathname.includes('/sandboxes') && hasEditorAccess && (
7474
<Button onClick={createNewFolder} variant="ghost" autoWidth>
7575
<Icon
7676
name="folder"

packages/app/src/app/pages/Dashboard/Components/Selection/ContextMenus/FolderMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ export const FolderMenu = ({ folder, setRenaming }: FolderMenuProps) => {
1515
const {
1616
dashboard: { deleteFolder },
1717
} = useActions();
18-
const { isTeamEditor } = useWorkspaceAuthorization();
18+
const { hasEditorAccess } = useWorkspaceAuthorization();
1919
const { visible, setVisibility, position } = React.useContext(Context);
2020

21-
if (!isTeamEditor) {
21+
if (!hasEditorAccess) {
2222
return null;
2323
}
2424

packages/app/src/app/pages/Dashboard/Content/routes/Sandboxes/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const SandboxesPage = () => {
2222
const items = useFilteredItems(currentPath, cleanParam, level);
2323
const actions = useActions();
2424
const { isFrozen } = useWorkspaceLimits();
25-
const { isTeamEditor } = useWorkspaceAuthorization();
25+
const { hasEditorAccess } = useWorkspaceAuthorization();
2626
const {
2727
dashboard: { allCollections },
2828
activeTeam,
@@ -89,7 +89,7 @@ export const SandboxesPage = () => {
8989
{isEmpty ? (
9090
<EmptyPage.StyledWrapper>
9191
<EmptyPage.StyledGrid>
92-
{(isTeamEditor) && (
92+
{hasEditorAccess && (
9393
<ActionCard
9494
icon="plus"
9595
disabled={isFrozen}

packages/app/src/app/pages/Dashboard/Sidebar/ContextMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ export const ContextMenu: React.FC<ContextMenuProps> = ({
3333
setNewFolderPath,
3434
}) => {
3535
const { deleteFolder } = useActions().dashboard;
36-
const { isTeamEditor } = useWorkspaceAuthorization();
36+
const { hasEditorAccess } = useWorkspaceAuthorization();
3737

3838
const history = useHistory();
3939
const location = useLocation();
4040

41-
if (!visible || !folder || !isTeamEditor) {
41+
if (!visible || !folder || !hasEditorAccess) {
4242
return null;
4343
};
4444

packages/app/src/app/pages/Dashboard/Sidebar/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
7979
const showRespositories = !state.environment.isOnPrem;
8080

8181
const { ubbBeta } = useWorkspaceFeatureFlags();
82-
const { isPrimarySpace, isTeamAdmin, isTeamEditor } = useWorkspaceAuthorization();
82+
const { isPrimarySpace, hasAdminAccess, hasEditorAccess } = useWorkspaceAuthorization();
8383
const { isPro } = useWorkspaceSubscription();
8484

8585
const showTemplates = state.activeTeam
@@ -158,7 +158,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
158158
path={dashboardUrls.getStarted(activeTeam)}
159159
icon="documentation"
160160
/>
161-
{isTeamAdmin && (
161+
{hasAdminAccess && (
162162
<RowItem
163163
name="Upgrade"
164164
page="external"
@@ -225,7 +225,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
225225
? [{ path: newFolderPath, name: '', parent: null }]
226226
: []),
227227
]}
228-
canEdit={isTeamEditor}
228+
canEdit={hasEditorAccess}
229229
/>
230230

231231
{showTemplates ? (

0 commit comments

Comments
 (0)