Commits

Antoni Segura Puimedon  committed 5256b8d

Added default avatar for non ldap users (or without img in ldap).

  • Participants
  • Parent commits 8195c95

Comments (0)

Files changed (3)

File app/models/picture.rb

             picture_data = entry[picture_attr][0]
         end
 
-        location = location_from_login(user_login)
-        File.open(location, 'wb') { |f| f.write(picture_data)}
+        if picture_data.nil?
+            location = spock_location()
+        else
+            location = location_from_login(user_login)
+            File.open(location, 'wb') { |f| f.write(picture_data)}
+        end
         Picture.create(:location => location, :user_id => user_id, :created => DateTime.now.to_date)
     end
 
         File.join(plugin_dir, 'assets', 'images', login+'.jpg')
     end
 
+    def self.spock_location()
+        filename = File.dirname(__FILE__)
+        plugin_dir = File.absolute_path(File.dirname(File.dirname(filename)))
+        File.join(plugin_dir, 'assets', 'images', 'vulcan_avatar.jpg')
+    end
+
     def old?
         max_time = Setting.plugin_redmine_gemavatar['refresh_days'].to_i
         now = DateTime.now.to_date

File assets/images/vulcan_avatar.jpg

Added
New image
   name 'Ldap avatar plugin'
   author 'Antoni Segura Puimedon'
   description 'Fetches avatars from LDAP'
-  version '1.0.2'
+  version '1.0.3'
   url ''
   author_url 'http://celebdor.com'
   settings :default => {'refresh_days' => '7'}, :partial => 'settings/gemavatar'