X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a942e37250873d383bd885ba0dba70c63b3c073d..39c17737ac69d7693684fe2f95bef0ec235a28bf:/services/api/app/models/group.rb diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb index 0e857ad15c..7a7f0a3a60 100644 --- a/services/api/app/models/group.rb +++ b/services/api/app/models/group.rb @@ -1,10 +1,19 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'can_be_an_owner' +require 'trashable' class Group < ArvadosModel include HasUuid include KindAndEtag include CommonApiTemplate include CanBeAnOwner + include Trashable + + serialize :properties, Hash + after_create :invalidate_permissions_cache after_update :maybe_invalidate_permissions_cache before_create :assign_name @@ -14,10 +23,14 @@ class Group < ArvadosModel t.add :group_class t.add :description t.add :writable_by + t.add :delete_at + t.add :trash_at + t.add :is_trashed + t.add :properties end def maybe_invalidate_permissions_cache - if uuid_changed? or owner_uuid_changed? + if uuid_changed? or owner_uuid_changed? or is_trashed_changed? # This can change users' permissions on other groups as well as # this one. invalidate_permissions_cache @@ -27,7 +40,7 @@ class Group < ArvadosModel def invalidate_permissions_cache # Ensure a new group can be accessed by the appropriate users # immediately after being created. - User.invalidate_permissions_cache + User.invalidate_permissions_cache db_current_time.to_i end def assign_name