X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ebb166d65eb37f89edeccfc5be97014f3f2a73e2..ef6f7202858cba65e06cc1a32d52ee2305687bc8:/services/api/app/models/group.rb diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb index d380244131..6105b5f35d 100644 --- a/services/api/app/models/group.rb +++ b/services/api/app/models/group.rb @@ -7,6 +7,7 @@ class Group < ArvadosModel include CanBeAnOwner after_create :invalidate_permissions_cache after_update :maybe_invalidate_permissions_cache + before_create :assign_name api_accessible :user, extend: :common do |t| t.add :name @@ -26,6 +27,14 @@ 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 + if self.new_record? and (self.name.nil? or self.name.empty?) + self.name = self.uuid + end + true + end + end