Merge branch 'master' into origin-2035-arv-mount-tags-folders
[arvados.git] / services / api / app / models / repository.rb
1 class Repository < ArvadosModel
2   include AssignUuid
3   include KindAndEtag
4   include CommonApiTemplate
5
6   api_accessible :user, extend: :common do |t|
7     t.add :name
8     t.add :fetch_url
9     t.add :push_url
10   end
11
12   def push_url
13     super || self.name && "git@git.#{Rails.configuration.uuid_prefix}.arvadosapi.com:#{self.name}.git"
14   end
15
16   def fetch_url
17     super || push_url
18   end
19
20   protected
21
22   def permission_to_create
23     current_user and current_user.is_admin
24   end
25   def permission_to_update
26     current_user and current_user.is_admin
27   end
28 end