X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fb95d0d2d09c9537f5bdc503e51cf4f091d02c46..fd7ac9bf21002cc8a3cdb9a5e16c588ff734dfab:/services/api/app/models/group.rb diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb index f05571651d..d380244131 100644 --- a/services/api/app/models/group.rb +++ b/services/api/app/models/group.rb @@ -5,6 +5,8 @@ class Group < ArvadosModel include KindAndEtag include CommonApiTemplate include CanBeAnOwner + after_create :invalidate_permissions_cache + after_update :maybe_invalidate_permissions_cache api_accessible :user, extend: :common do |t| t.add :name @@ -12,4 +14,18 @@ class Group < ArvadosModel t.add :description t.add :writable_by end + + def maybe_invalidate_permissions_cache + if uuid_changed? or owner_uuid_changed? + # This can change users' permissions on other groups as well as + # this one. + invalidate_permissions_cache + end + end + + def invalidate_permissions_cache + # Ensure a new group can be accessed by the appropriate users + # immediately after being created. + User.invalidate_permissions_cache + end end