mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #630 from ynput/enhancement/register-username-during-publishing
Chore: Use origin username when running publish
This commit is contained in:
commit
f1b8d0858c
1 changed files with 15 additions and 1 deletions
|
|
@ -64,9 +64,10 @@ class Commands:
|
|||
get_global_context,
|
||||
)
|
||||
|
||||
# Register target and host
|
||||
import ayon_api
|
||||
import pyblish.util
|
||||
|
||||
# Register target and host
|
||||
if not isinstance(path, str):
|
||||
raise RuntimeError("Path to JSON must be a string.")
|
||||
|
||||
|
|
@ -86,6 +87,19 @@ class Commands:
|
|||
|
||||
log = Logger.get_logger("CLI-publish")
|
||||
|
||||
# Make public ayon api behave as other user
|
||||
# - this works only if public ayon api is using service user
|
||||
username = os.environ.get("AYON_USERNAME")
|
||||
if username:
|
||||
# NOTE: ayon-python-api does not have public api function to find
|
||||
# out if is used service user. So we need to have try > except
|
||||
# block.
|
||||
con = ayon_api.get_server_api_connection()
|
||||
try:
|
||||
con.set_default_service_username(username)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
install_ayon_plugins()
|
||||
|
||||
manager = AddonsManager()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue