From 8e99a265ddea62b58b506856a20e371c454fd437 Mon Sep 17 00:00:00 2001 From: Giuseppe Lo Presti Date: Tue, 12 Oct 2021 16:53:15 +0200 Subject: [PATCH] Refactoring: renamed userid to ownerid on stat-related code --- src/core/cs3iface.py | 2 +- src/core/localiface.py | 2 +- src/core/wopi.py | 2 +- src/core/xrootiface.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/cs3iface.py b/src/core/cs3iface.py index a6eed5c8..40d6bba8 100644 --- a/src/core/cs3iface.py +++ b/src/core/cs3iface.py @@ -86,7 +86,7 @@ def stat(endpoint, fileid, userid, versioninv=0): inode = urlsafe_b64encode(statInfo.info.id.opaque_id.encode()) return {'inode': statInfo.info.id.storage_id + '-' + inode.decode(), 'filepath': statInfo.info.path, - 'userid': statInfo.info.owner.opaque_id + '@' + statInfo.info.owner.idp, + 'ownerid': statInfo.info.owner.opaque_id + '@' + statInfo.info.owner.idp, 'size': statInfo.info.size, 'mtime': statInfo.info.mtime.seconds } diff --git a/src/core/localiface.py b/src/core/localiface.py index 96f36aa1..cb12659d 100644 --- a/src/core/localiface.py +++ b/src/core/localiface.py @@ -53,7 +53,7 @@ def stat(_endpoint, filepath, _userid): return { 'inode': str(statInfo.st_ino), 'filepath': filepath, - 'userid': str(statInfo.st_uid) + ':' + str(statInfo.st_gid), + 'ownerid': str(statInfo.st_uid) + ':' + str(statInfo.st_gid), 'size': statInfo.st_size, 'mtime': statInfo.st_mtime } diff --git a/src/core/wopi.py b/src/core/wopi.py index 52f12c0c..13c6f413 100644 --- a/src/core/wopi.py +++ b/src/core/wopi.py @@ -60,7 +60,7 @@ def checkFileInfo(fileid): if acctok['viewmode'] in (utils.ViewMode.READ_ONLY, utils.ViewMode.READ_WRITE): filemd['DownloadUrl'] = '%s?access_token=%s' % \ (srv.config.get('general', 'downloadurl'), flask.request.args['access_token']) - filemd['OwnerId'] = statInfo['userid'] + filemd['OwnerId'] = statInfo['ownerid'] filemd['UserId'] = acctok['wopiuser'] # typically same as OwnerId; different when accessing shared documents filemd['Size'] = statInfo['size'] # TODO the version is generated like this in ownCloud: 'V' . $file->getEtag() . \md5($file->getChecksum()); diff --git a/src/core/xrootiface.py b/src/core/xrootiface.py index 8d1df8b0..54c4b1c7 100644 --- a/src/core/xrootiface.py +++ b/src/core/xrootiface.py @@ -156,7 +156,7 @@ def statx(endpoint, filepath, userid, versioninv=0): log.debug('msg="Invoked stat return" inode="%s" filepath="%s"' % (inode, _getfilepath(filepath))) return {'inode': inode, 'filepath': filepath, - 'userid': statxdata[5] + ':' + statxdata[6], + 'ownerid': statxdata[5] + ':' + statxdata[6], 'size': int(statxdata[8]), 'mtime': int(statxdata[12])} # now stat the corresponding version folder to get an inode invariant to save operations, see CERNBOX-1216 @@ -189,7 +189,7 @@ def statx(endpoint, filepath, userid, versioninv=0): log.debug('msg="Invoked stat return" inode="%s" filepath="%s"' % (inode, _getfilepath(verFolder))) return {'inode': inode, 'filepath': filepath, - 'userid': statxdata[5] + ':' + statxdata[6], + 'ownerid': statxdata[5] + ':' + statxdata[6], 'size': int(statxdata[8]), 'mtime': int(statxdata[12])}