lib/place/project.rb
# Retrieve all participation of users in project, with its own roles
Retrieve all participation of users in project, with its own roles
Retrieve all participation of users in project with its own roles
def retrieve_participations
	Dir.glob("#{url}/security/user-roles.xml").each do |filename|
	  content = IO.readlines(filename).join
      doc = Nokogiri::XML(content)
	  doc.xpath('//user-roles/user').each do |udata|
	    u = User.find_by_name(udata['name'])
		unless u.nil?
		  p = Participation.create(:project => self, :user => u)
		  udata.xpath('role').map{|i| i['name']}.each{|r| p.roles << r}
		  p.save
		  Place.logger.info("saved participation: #{u.name}, #{self.name}")
		end
	  end
	end
  end
def retrieve_participations Dir . glob ( "#{url}/security/user-roles.xml" ) . each do | filename | content = IO . readlines ( filename ) . join doc = Nokogiri :: XML ( content ) doc . xpath ( '//user-roles/user' ) . each do | udata | u = User . find_by_name ( udata [ 'name' ] ) unless u . nil? p = Participation . create ( :project => self , :user => u ) udata . xpath ( 'role' ) . map { | i | i [ 'name' ] } . each { | r | p . roles << r } p . save Place . logger . info ( "saved participation: #{u.name}, #{self.name}" ) end end end end
Retrieve all participation of users in project, with its own roles
Retrieve all participation of users in project with its own roles