ui styles
This commit is contained in:
parent
83c6951f7d
commit
5c006da27d
2 changed files with 22 additions and 4 deletions
|
|
@ -201,7 +201,15 @@ class SharepointProcessor:
|
|||
|
||||
async def _matchConnectionToPath(self, connections: list, sharepointPath: str):
|
||||
try:
|
||||
if not sharepointPath or not sharepointPath.startswith('https://'):
|
||||
logger.warning(f"Invalid sharepointPath for matching: {sharepointPath}")
|
||||
return connections[0] if connections else None
|
||||
|
||||
targetDomain = urlparse(sharepointPath).netloc.lower()
|
||||
if not targetDomain:
|
||||
logger.warning(f"Could not extract domain from path: {sharepointPath}")
|
||||
return connections[0] if connections else None
|
||||
|
||||
logger.info(f"Looking for connection matching domain: {targetDomain}")
|
||||
|
||||
for connection in connections:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class SharepointService:
|
|||
"""Set access token from UserConnection.
|
||||
|
||||
Args:
|
||||
userConnection: UserConnection object containing token information
|
||||
userConnection: UserConnection object or dict containing token information
|
||||
|
||||
Returns:
|
||||
bool: True if token was set successfully, False otherwise
|
||||
|
|
@ -37,15 +37,25 @@ class SharepointService:
|
|||
logger.error("UserConnection is required to set access token")
|
||||
return False
|
||||
|
||||
# Handle both dict and UserConnection object
|
||||
if isinstance(userConnection, dict):
|
||||
connectionId = userConnection.get('id')
|
||||
else:
|
||||
connectionId = getattr(userConnection, 'id', None)
|
||||
|
||||
if not connectionId:
|
||||
logger.error("UserConnection must have an 'id' field")
|
||||
return False
|
||||
|
||||
# Get a fresh token for this specific connection
|
||||
from modules.security.tokenManager import TokenManager
|
||||
token = TokenManager().getFreshToken(userConnection.id)
|
||||
token = TokenManager().getFreshToken(connectionId)
|
||||
if not token:
|
||||
logger.error(f"No token found for connection {userConnection.id}")
|
||||
logger.error(f"No token found for connection {connectionId}")
|
||||
return False
|
||||
|
||||
self.accessToken = token.tokenAccess
|
||||
logger.info(f"Access token set for connection {userConnection.id}")
|
||||
logger.info(f"Access token set for connection {connectionId}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Reference in a new issue