mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 17:00:36 -05:00
Merge pull request #1995 from penpot/superalex-add-team-and-project-ids-to-update-file-audit-log
✨ Add team and project ids to update-file mutation for audit log
This commit is contained in:
commit
206ffcc6e8
1 changed files with 8 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
|
[app.loggers.audit :as audit]
|
||||||
[app.metrics :as mtx]
|
[app.metrics :as mtx]
|
||||||
[app.rpc.permissions :as perms]
|
[app.rpc.permissions :as perms]
|
||||||
[app.rpc.queries.files :as files]
|
[app.rpc.queries.files :as files]
|
||||||
|
@ -279,10 +280,14 @@
|
||||||
[{:keys [pool] :as cfg} {:keys [id profile-id] :as params}]
|
[{:keys [pool] :as cfg} {:keys [id profile-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(db/xact-lock! conn id)
|
(db/xact-lock! conn id)
|
||||||
(let [{:keys [id] :as file} (db/get-by-id conn :file id {:for-key-share true})]
|
(let [{:keys [id] :as file} (db/get-by-id conn :file id {:for-key-share true})
|
||||||
|
team-id (retrieve-team-id conn (:project-id file))]
|
||||||
(files/check-edition-permissions! conn profile-id id)
|
(files/check-edition-permissions! conn profile-id id)
|
||||||
(update-file (assoc cfg :conn conn)
|
(with-meta
|
||||||
(assoc params :file file)))))
|
(update-file (assoc cfg :conn conn)
|
||||||
|
(assoc params :file file))
|
||||||
|
{::audit/props {:project-id (:project-id file)
|
||||||
|
:team-id team-id}}))))
|
||||||
|
|
||||||
(defn- take-snapshot?
|
(defn- take-snapshot?
|
||||||
"Defines the rule when file `data` snapshot should be saved."
|
"Defines the rule when file `data` snapshot should be saved."
|
||||||
|
|
Loading…
Reference in a new issue