1 require 'can_be_an_owner'
3 class Group < ArvadosModel
6 include CommonApiTemplate
8 after_create :invalidate_permissions_cache
9 after_update :maybe_invalidate_permissions_cache
10 before_create :assign_name
12 api_accessible :user, extend: :common do |t|
19 def maybe_invalidate_permissions_cache
20 if uuid_changed? or owner_uuid_changed?
21 # This can change users' permissions on other groups as well as
23 invalidate_permissions_cache
27 def invalidate_permissions_cache
28 # Ensure a new group can be accessed by the appropriate users
29 # immediately after being created.
30 User.invalidate_permissions_cache
34 if self.new_record? and (self.name.nil? or self.name.empty?)