X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a8da71bb7b0c4f319afd50ee6cd5d593f1237d33..27daf08f38eec505c224e7776678b32d50241e13:/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