@@ -117,13 +117,17 @@ func (b *versionedKVBackend) pathUndeleteWrite() framework.OperationFunc {
117117 return nil , nil
118118 }
119119
120+ //Get attribution info
121+ attribution := getAttribution (req )
122+
120123 for _ , verNum := range versions {
121124 // If there is no version or the version is destroyed continue
122125 lv := meta .Versions [uint64 (verNum )]
123126 if lv == nil || lv .Destroyed {
124127 continue
125128 }
126129 lv .DeletionTime = nil
130+ lv .DeletedBy = nil
127131
128132 if ! config .IsDeleteVersionAfterDisabled () {
129133 if dtime , ok := deletionTime (time .Now (), deleteVersionAfter (config ), deleteVersionAfter (meta )); ok {
@@ -135,14 +139,19 @@ func (b *versionedKVBackend) pathUndeleteWrite() framework.OperationFunc {
135139 }
136140 }
137141 }
142+ attribution .Operation = "undelete"
143+ meta .LastUpdatedBy = attribution
144+
138145 err = b .writeKeyMetadata (ctx , req .Storage , meta )
139146 if err != nil {
140147 return nil , err
141148 }
149+
142150 marshaledVersions , err := json .Marshal (& versions )
143151 if err != nil {
144152 return nil , err
145153 }
154+
146155 kvEvent (ctx , b .Backend , "undelete" , "undelete/" + key , "data/" + key , true , 2 ,
147156 "current_version" , fmt .Sprintf ("%d" , meta .CurrentVersion ),
148157 "oldest_version" , fmt .Sprintf ("%d" , meta .OldestVersion ),
@@ -179,6 +188,9 @@ func (b *versionedKVBackend) pathDeleteWrite() framework.OperationFunc {
179188 return nil , nil
180189 }
181190
191+ // Get attribution info
192+ attribution := getAttribution (req )
193+
182194 for _ , verNum := range versions {
183195 // If there is no latest version, or the latest version is already
184196 // deleted or destroyed continue
@@ -199,8 +211,11 @@ func (b *versionedKVBackend) pathDeleteWrite() framework.OperationFunc {
199211 }
200212
201213 lv .DeletionTime = ptypes .TimestampNow ()
214+ lv .DeletedBy = attribution
202215 }
203216
217+ meta .LastUpdatedBy = attribution
218+
204219 err = b .writeKeyMetadata (ctx , req .Storage , meta )
205220 if err != nil {
206221 return nil , err
0 commit comments