[Git][noosfero/noosfero][stable-1.7] access-level: small tweaks

Rodrigo Souto gitlab at mg.gitlab.com
Mon Jan 23 15:55:32 BRST 2017


Rodrigo Souto pushed to branch stable-1.7 at Noosfero / noosfero


Commits:
6c5549eb by Rodrigo Souto at 2017-01-23T14:55:12-03:00
access-level: small tweaks

- - - - -


2 changed files:

- db/migrate/20170120221747_update_access_level_settings.rb
- lib/access_levels.rb


Changes:

=====================================
db/migrate/20170120221747_update_access_level_settings.rb
=====================================
--- a/db/migrate/20170120221747_update_access_level_settings.rb
+++ b/db/migrate/20170120221747_update_access_level_settings.rb
@@ -6,14 +6,14 @@ class UpdateAccessLevelSettings < ActiveRecord::Migration
       'related' => 2,
       'self' => 3,
     }
-    
-    select_all("SELECT id, data FROM profiles WHERE type='Person' AND data LIKE '%:wall_access:%'").each do |person|
+
+    select_all("SELECT id, data FROM profiles WHERE type='Person' AND data LIKE '%:wall_access:%'").find_each do |person|
       data = YAML.load(person['data'] || {}.to_yaml)
       data[:wall_access] = valid_levels[data[:wall_access]] || valid_levels['self']
       update("UPDATE profiles SET data=#{connection.quote(data.to_yaml)} WHERE id=#{person['id']}")
     end
 
-    select_all("SELECT id, setting FROM articles WHERE type='Forum' AND setting LIKE '%:topic_creation:%'").each do |forum|
+    select_all("SELECT id, setting FROM articles WHERE type='Forum' AND setting LIKE '%:topic_creation:%'").find_each do |forum|
       data = YAML.load(forum['setting'] || {}.to_yaml)
       data[:topic_creation] = valid_levels[data[:topic_creation]] || valid_levels['self']
       update("UPDATE articles SET setting=#{connection.quote(data.to_yaml)} WHERE id=#{forum['id']}")


=====================================
lib/access_levels.rb
=====================================
--- a/lib/access_levels.rb
+++ b/lib/access_levels.rb
@@ -1,16 +1,16 @@
 class AccessLevels
 
   LEVELS = {
-    # The profile will always be visible, even to anonymous users
+    # Accessible to any visitor
     visitors: 0,
 
-    # Any logged user will be able to view the profile
+    # Accessible only to logged users
     users: 1,
 
-    # The profile will be visible for friends and members
+    # Accessible only to friends or members
     related: 2,
 
-    # Only owners or admins can view the profile
+    # Accessible only to owners or administrators
     self: 3
   }
 



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/6c5549ebfea67dc06b83ccfe37d29ff37c9bb630
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170123/be95e902/attachment-0001.html>


More information about the Noosfero-dev mailing list