projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '8784-dir-listings'
[arvados.git]
/
services
/
api
/
app
/
controllers
/
arvados
/
v1
/
collections_controller.rb
diff --git
a/services/api/app/controllers/arvados/v1/collections_controller.rb
b/services/api/app/controllers/arvados/v1/collections_controller.rb
index 939ca212579c25c6e7f245fed6bf6e251fe4998a..87d88fe4f584092e06315ad9eb9f93f0593b850c 100644
(file)
--- a/
services/api/app/controllers/arvados/v1/collections_controller.rb
+++ b/
services/api/app/controllers/arvados/v1/collections_controller.rb
@@
-1,8
+1,22
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
require "arvados/keep"
class Arvados::V1::CollectionsController < ApplicationController
include DbCurrentTime
require "arvados/keep"
class Arvados::V1::CollectionsController < ApplicationController
include DbCurrentTime
+ def self._index_requires_parameters
+ (super rescue {}).
+ merge({
+ include_trash: {
+ type: 'boolean', required: false, description: "Include collections whose is_trashed attribute is true."
+ },
+ })
+ end
+
+
def create
if resource_attrs[:uuid] and (loc = Keep::Locator.parse(resource_attrs[:uuid]))
resource_attrs[:portable_data_hash] = loc.to_s
def create
if resource_attrs[:uuid] and (loc = Keep::Locator.parse(resource_attrs[:uuid]))
resource_attrs[:portable_data_hash] = loc.to_s
@@
-12,7
+26,7
@@
class Arvados::V1::CollectionsController < ApplicationController
end
def find_objects_for_index
end
def find_objects_for_index
- if params[:include_trash] || ['destroy', 'trash'].include?(action_name)
+ if params[:include_trash] || ['destroy', 'trash'
, 'untrash'
].include?(action_name)
@objects = Collection.unscoped.readable_by(*@read_users)
end
super
@objects = Collection.unscoped.readable_by(*@read_users)
end
super
@@
-63,6
+77,21
@@
class Arvados::V1::CollectionsController < ApplicationController
show
end
show
end
+ def untrash
+ if @object.is_trashed
+ @object.trash_at = nil
+
+ if params[:ensure_unique_name]
+ @object.save_with_unique_name!
+ else
+ @object.save!
+ end
+ else
+ raise InvalidStateTransitionError
+ end
+ show
+ end
+
def find_collections(visited, sp, &b)
case sp
when ArvadosModel
def find_collections(visited, sp, &b)
case sp
when ArvadosModel