File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 2020 QgsExpressionContextUtils ,
2121 Qgis ,
2222 QgsProject ,
23- QgsDataSourceUri ,
23+ QgsProviderRegistry ,
2424)
2525from qgis .PyQt .QtCore import QSettings , QUrl
2626from qgis .PyQt .QtNetwork import QNetworkRequest
@@ -582,11 +582,14 @@ def __init__(self, qgis_file=None):
582582 def get_layers_auth_ids (self ) -> list [str ]:
583583 """Get the auth config IDs of the protected layers in the current project."""
584584 auth_ids = set ()
585+ reg = QgsProviderRegistry .instance ()
585586 for layer in self .project .mapLayers ().values ():
586587 source = layer .source ()
587- uri = QgsDataSourceUri (source )
588- if uri .authConfigId ():
589- auth_ids .add (uri .authConfigId ())
588+ prov_type = layer .providerType ()
589+ decoded_uri = reg .decodeUri (prov_type , source )
590+ auth_id = decoded_uri .get ("authcfg" )
591+ if auth_id :
592+ auth_ids .add (auth_id )
590593 return list (auth_ids )
591594
592595 def get_auth_config_hash (self , auth_ids : list [str ]) -> str :
You can’t perform that action at this time.
0 commit comments