mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Ignore private packages if user not authorized
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from platformio import __registry_api__, fs
|
from platformio import __registry_api__, fs
|
||||||
from platformio.clients.account import AccountClient
|
from platformio.clients.account import AccountClient, AccountNotAuthorized
|
||||||
from platformio.clients.http import HTTPClient, HTTPClientError
|
from platformio.clients.http import HTTPClient, HTTPClientError
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
@ -32,10 +32,13 @@ class RegistryClient(HTTPClient):
|
|||||||
"service.registry.publish-private-library",
|
"service.registry.publish-private-library",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
info = AccountClient().get_account_info() or {}
|
try:
|
||||||
for item in info.get("packages", []):
|
info = AccountClient().get_account_info() or {}
|
||||||
if set(item.keys()) & private_permissions:
|
for item in info.get("packages", []):
|
||||||
return True
|
if set(item.keys()) & private_permissions:
|
||||||
|
return True
|
||||||
|
except AccountNotAuthorized:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def send_auth_request(self, *args, **kwargs):
|
def send_auth_request(self, *args, **kwargs):
|
||||||
|
Reference in New Issue
Block a user