-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Get the users with whom a file is being shared (#72)
* feat: Get the users with whom a file is being shared Endpoint to get the users with whom a file is shared. Testing has not been implemented yet * refactor: Enpoint correction in addition to updating the spec --------- Co-authored-by: Andvelavi <[email protected]>
- Loading branch information
1 parent
a30478b
commit 9373052
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from src.config.soap_client import soap_client | ||
from src.lib.helpers import is_valid_uuid | ||
|
||
|
||
def shared_with_who_handler(token, file_uuid): | ||
try: | ||
if not is_valid_uuid(file_uuid): | ||
return {"msg": "Not valid file UUID provided"}, 400 | ||
|
||
request_data = {"fileUUID": file_uuid, "token": token} | ||
response = soap_client.service.share_list_with_who(request_data) | ||
|
||
if response.usernames is None: | ||
return {"msg": response["msg"]}, response["code"] | ||
|
||
usernames = [ | ||
{ | ||
"users": usernames, | ||
} | ||
for usernames in response.usernames | ||
] | ||
|
||
return { | ||
"users": usernames, | ||
"msg": "List of users the file is shared with", | ||
}, 200 | ||
except Exception as e: | ||
print("[Exception] shared_with_who_handler ->", e) | ||
return {"msg": "There was an error listing the shared with"}, 500 |