ui styles

This commit is contained in:
ValueOn AG 2025-11-02 13:05:20 +01:00
parent 83c6951f7d
commit 5c006da27d
2 changed files with 22 additions and 4 deletions

View file

@ -201,7 +201,15 @@ class SharepointProcessor:
async def _matchConnectionToPath(self, connections: list, sharepointPath: str): async def _matchConnectionToPath(self, connections: list, sharepointPath: str):
try: 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() 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}") logger.info(f"Looking for connection matching domain: {targetDomain}")
for connection in connections: for connection in connections:

View file

@ -27,7 +27,7 @@ class SharepointService:
"""Set access token from UserConnection. """Set access token from UserConnection.
Args: Args:
userConnection: UserConnection object containing token information userConnection: UserConnection object or dict containing token information
Returns: Returns:
bool: True if token was set successfully, False otherwise bool: True if token was set successfully, False otherwise
@ -37,15 +37,25 @@ class SharepointService:
logger.error("UserConnection is required to set access token") logger.error("UserConnection is required to set access token")
return False 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 # Get a fresh token for this specific connection
from modules.security.tokenManager import TokenManager from modules.security.tokenManager import TokenManager
token = TokenManager().getFreshToken(userConnection.id) token = TokenManager().getFreshToken(connectionId)
if not token: if not token:
logger.error(f"No token found for connection {userConnection.id}") logger.error(f"No token found for connection {connectionId}")
return False return False
self.accessToken = token.tokenAccess 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 return True
except Exception as e: except Exception as e: