-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Organization.PluginsAccess * Rename PluginsAccess to PluginsAccessLevel * Use Organization.plugins_access_level in can_…_plugins_via_api * Add migration for Organization.plugins_access_level * Remove unused PLUGINS_CLOUD_WHITELISTED_ORG_IDS * Update access.py * Add OrganizationPluginsAccessLevel TS enum * Fix merge * Disable LocalPlugin UI on Cloud * Move away from PluginAccess interface * Extend PluginsAccessLevel range * Refactor PluginsAccessLevel for brevity * Remove PluginAccess interface completely * Add plugins managed globally * Update migration * Show managing org name in "Managed" plugin tag * Smoothen some rough edges * Smoothen more edges * Restore correct MULTI_TENANCY default * All the edges * Fix most existing tests * Remove PLUGINS_*_VIA_API env var support * Update pluginsNeedingUpdates * Remove can_*_plugins_via_api from instance status page * Add tests and polish permissioning * Update migration * Fix typing * Make plugin drawer UI less intrusive * Update migration * Fix Uninstall button condition * Use unified _preflight status endpoint instead of the custom plugins one * Fix plugin update label condition * Fix "Check for updates" button condition * Explain PluginsAccessLevel choices with comments * Hide global plugin installation option on self-hosted * Don't actions.loadRepository() as install org * Improve permissioning with tests * Satisfy mypy * Add plugins access level to admin and fix org admin * Check plugins access level more * Rename endWithPeriod * Refactor FE access control checks to accessControl.ts * Deduplicate permissioning * Add exception message * Align backend and frontend plugins access level helpers * Add plugins access level helper tests * Fix ChartFilter
- Loading branch information
Showing
37 changed files
with
1,168 additions
and
711 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { PluginsAccessLevel } from '../../lib/constants' | ||
import { OrganizationType } from '../../types' | ||
|
||
export function canGloballyManagePlugins(organization: OrganizationType | null | undefined): boolean { | ||
if (!organization) { | ||
return false | ||
} | ||
return organization.plugins_access_level >= PluginsAccessLevel.Root | ||
} | ||
|
||
export function canInstallPlugins( | ||
organization: OrganizationType | null | undefined, | ||
specificOrganizationId?: string | ||
): boolean { | ||
if (!organization) { | ||
return false | ||
} | ||
if (specificOrganizationId && organization.id !== specificOrganizationId) { | ||
return false | ||
} | ||
return organization.plugins_access_level >= PluginsAccessLevel.Install | ||
} | ||
|
||
export function canConfigurePlugins(organization: OrganizationType | null | undefined): boolean { | ||
if (!organization) { | ||
return false | ||
} | ||
return organization.plugins_access_level >= PluginsAccessLevel.Config | ||
} | ||
|
||
export function canViewPlugins(organization: OrganizationType | null | undefined): boolean { | ||
if (!organization) { | ||
return false | ||
} | ||
return organization.plugins_access_level > PluginsAccessLevel.None | ||
} |
Oops, something went wrong.