repository.rb revision d79e030993a7d41dd0becfe941633e23997a6717
8a5e793a0576250da80371e53aa3e7eba15cdb63Sumit Bose attr_accessible :name, :description, :source_type, :source_address, :is_private
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose OR id IN (SELECT item_id FROM permissions WHERE item_type = 'Repository' AND subject_type = 'User' AND subject_id = ?)
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose OR id IN (SELECT item_id FROM permissions INNER JOIN team_users ON team_users.team_id = permissions.subject_id AND team_users.user_id = ?
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose WHERE item_type = 'Repository' AND subject_type = 'Team')", user, user)
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose # list all failed versions, grouped by their errors
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose versions = self.ontologies.map{|o| o.versions.last}.compact
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose versions.select{|v| v.state!="done"}.group_by do |v|
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose title << err[0,50] + " ... " + err.match("exited with status.*")[0]
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose title << err.each_line.first
2ca45dfa0144fea08bd360dafded57bc90111e68Sumit Bose title.join(": ")
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose def clear_readers
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose if is_private_changed?
6b5044001e4b0a0caf971a2cf5f27674e0d270f4Sumit Bose permissions.where(role: 'reader').each { |p| p.destroy }