X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fd7ac9bf21002cc8a3cdb9a5e16c588ff734dfab..15c86f88f1f5124c082e77dedd0b97c5efc93388:/services/api/app/models/group.rb diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb index d380244131..0e857ad15c 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 @@ -28,4 +29,12 @@ class Group < ArvadosModel # immediately after being created. User.invalidate_permissions_cache end + + def assign_name + if self.new_record? and (self.name.nil? or self.name.empty?) + self.name = self.uuid + end + true + end + end