mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
use AYON_USERNAME during publishing
This commit is contained in:
parent
29090778a5
commit
43787fd9c3
1 changed files with 14 additions and 1 deletions
|
|
@ -64,9 +64,10 @@ class Commands:
|
||||||
get_global_context,
|
get_global_context,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register target and host
|
import ayon_api
|
||||||
import pyblish.util
|
import pyblish.util
|
||||||
|
|
||||||
|
# Register target and host
|
||||||
if not isinstance(path, str):
|
if not isinstance(path, str):
|
||||||
raise RuntimeError("Path to JSON must be a string.")
|
raise RuntimeError("Path to JSON must be a string.")
|
||||||
|
|
||||||
|
|
@ -86,6 +87,18 @@ class Commands:
|
||||||
|
|
||||||
log = Logger.get_logger("CLI-publish")
|
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.
|
||||||
|
try:
|
||||||
|
ayon_api.set_default_service_username(username)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
install_ayon_plugins()
|
install_ayon_plugins()
|
||||||
|
|
||||||
manager = AddonsManager()
|
manager = AddonsManager()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue