Skip to content

Commit

Permalink
add perm for global db add
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Mar 4, 2022
1 parent 77063cc commit cec2a42
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions superset-frontend/src/views/components/MenuRight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const RightMenu = ({
const canSql = findPermission('can_sqllab', 'Superset', roles);
const canDashboard = findPermission('can_write', 'Dashboard', roles);
const canChart = findPermission('can_write', 'Chart', roles);
const canDatabase = findPermission('can_write', 'Database', roles);
const showActionDropdown = canSql || canChart || canDashboard;
const dropdownItems: MenuObjectProps[] = [
{
Expand All @@ -94,12 +95,12 @@ const RightMenu = ({
{
label: t('Connect Database'),
name: GlobalMenuDataOptions.DB_CONNECTION,
perm: true,
perm: canDatabase,
},
{
label: t('Connect Google Sheet'),
name: GlobalMenuDataOptions.GOOGLE_SHEETS,
perm: HAS_GSHEETS_INSTALLED,
perm: canDatabase && HAS_GSHEETS_INSTALLED,
},
{
label: t('Upload a CSV'),
Expand Down Expand Up @@ -183,7 +184,7 @@ const RightMenu = ({
>
{dropdownItems.map(menu => {
if (menu.childs) {
return (
return canDatabase ? (
<SubMenu
key="sub2"
className="data-menu"
Expand All @@ -206,7 +207,7 @@ const RightMenu = ({
) : null,
)}
</SubMenu>
);
) : null;
}
return (
findPermission(
Expand Down

0 comments on commit cec2a42

Please sign in to comment.