mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
fill createdBy and updateBy
This commit is contained in:
parent
70298b878d
commit
ef4e779e06
1 changed files with 15 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import arrow
|
|||
import ayon_api
|
||||
from ayon_api.operations import OperationsSession
|
||||
|
||||
from ayon_core.lib import get_ayon_username
|
||||
from ayon_core.pipeline.template_data import (
|
||||
get_template_data,
|
||||
get_task_template_data,
|
||||
|
|
@ -23,6 +24,8 @@ from ayon_core.tools.workfiles.abstract import (
|
|||
WorkfileInfo,
|
||||
)
|
||||
|
||||
_NOT_SET = object()
|
||||
|
||||
|
||||
class CommentMatcher(object):
|
||||
"""Use anatomy and work file data to parse comments from filenames.
|
||||
|
|
@ -445,6 +448,7 @@ class WorkfileEntitiesModel:
|
|||
self._controller = controller
|
||||
self._cache = {}
|
||||
self._items = {}
|
||||
self._current_username = _NOT_SET
|
||||
|
||||
def _get_workfile_info_identifier(
|
||||
self, folder_id, task_id, rootless_path
|
||||
|
|
@ -563,13 +567,18 @@ class WorkfileEntitiesModel:
|
|||
|
||||
project_name = self._controller.get_current_project_name()
|
||||
|
||||
username = self._get_current_username()
|
||||
workfile_info = {
|
||||
"path": rootless_path,
|
||||
"taskId": task_id,
|
||||
"attrib": {
|
||||
"extension": extension,
|
||||
"description": note
|
||||
}
|
||||
},
|
||||
# TODO remove 'createdBy' and 'updatedBy' fields when server is
|
||||
# or above 1.1.3 .
|
||||
"createdBy": username,
|
||||
"updatedBy": username,
|
||||
}
|
||||
|
||||
session = OperationsSession()
|
||||
|
|
@ -577,6 +586,11 @@ class WorkfileEntitiesModel:
|
|||
session.commit()
|
||||
return workfile_info
|
||||
|
||||
def _get_current_username(self):
|
||||
if self._current_username is _NOT_SET:
|
||||
self._current_username = get_ayon_username()
|
||||
return self._current_username
|
||||
|
||||
|
||||
class PublishWorkfilesModel:
|
||||
"""Model for handling of published workfiles.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue