myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2170] branches/apace: svn merge -r2165:2169 svn+


From: noreply
Subject: [myexperiment-hackers] [2170] branches/apace: svn merge -r2165:2169 svn+ssh://address@hidden/ var/svn/myexperiment/trunk
Date: Wed, 8 Apr 2009 10:41:09 -0400 (EDT)

Revision
2170
Author
dgc
Date
2009-04-08 10:41:09 -0400 (Wed, 08 Apr 2009)

Log Message

svn merge -r2165:2169 svn+ssh://address@hidden/var/svn/myexperiment/trunk

Modified Paths

Diff

Modified: branches/apace/app/helpers/application_helper.rb (2169 => 2170)


--- branches/apace/app/helpers/application_helper.rb	2009-04-08 14:29:13 UTC (rev 2169)
+++ branches/apace/app/helpers/application_helper.rb	2009-04-08 14:41:09 UTC (rev 2170)
@@ -775,7 +775,7 @@
     when "register_application"
       return "famfamfam_silk/application_edit.png"
     else
-      return nil
+      return Conf.label_icons[method.to_s] if Conf.label_icons[method.to_s]
     end
   end
   

Modified: branches/apace/config/default_settings.yml (2169 => 2170)


--- branches/apace/config/default_settings.yml	2009-04-08 14:29:13 UTC (rev 2169)
+++ branches/apace/config/default_settings.yml	2009-04-08 14:41:09 UTC (rev 2170)
@@ -354,3 +354,15 @@
     label: pack
     link:  /packs
 
+# label_icons - This is a list of icon types to icons.
+#
+#               Example:
+#
+#                 label_icons:
+#
+#                   workflow: redmond_studio/applications_16.png
+#                   blob:     redmond_studio/documents_16.png
+#                   pack:     manhattan_studio/folder-closed_16.png
+
+label_icons:
+

Modified: branches/apace/lib/authorization.rb (2169 => 2170)


--- branches/apace/lib/authorization.rb	2009-04-08 14:29:13 UTC (rev 2169)
+++ branches/apace/lib/authorization.rb	2009-04-08 14:41:09 UTC (rev 2170)
@@ -158,7 +158,7 @@
     #
     # this is required to get "policy_id" for policy-based aurhorized objects (like workflows / blobs / packs / contributions)
     # and to get objects themself for other object types (networks, experiments, jobs, tavernaenactors, runners)
-    if (thing_contribution.nil? && ["Workflow", "Blob", "Pack", "Contribution"].include?(thing_type)) || 
+    if (thing_contribution.nil? && ["Workflow", "Blog", "Blob", "Pack", "Contribution"].include?(thing_type)) || 
        (thing_instance.nil? && ["Network", "Comment", "Experiment", "Job", "TavernaEnactor", "Runner"].include?(thing_type))
       
       found_thing = find_thing(thing_type, thing_id)
@@ -168,7 +168,7 @@
         logger.error("UNEXPECTED ERROR - Couldn't find object to be authorized:(#{thing_type}, #{thing_id}); action: #{action_name}; user: #{user_id}")
         return false
       else
-        if ["Workflow", "Blob", "Pack", "Contribution"].include?(thing_type)
+        if ["Workflow", "Blog", "Blob", "Pack", "Contribution"].include?(thing_type)
           # "contribution" are only found for these three types of object (and the contributions themself),
           # for all the rest - use instances
           thing_contribution = found_thing
@@ -184,7 +184,7 @@
     is_authorized = false
     
     case thing_type
-      when "Workflow", "Blob", "Pack", "Contribution"
+      when "Workflow", "Blog", "Blob", "Pack", "Contribution"
         unless user_id.nil?
           # access is authorized and no further checks required in two cases:
           # ** user is the owner of the "thing"
@@ -354,7 +354,7 @@
     
     begin
       case thing_type
-        when "Workflow", "Blob", "Pack"
+        when "Workflow", "Blog", "Blob", "Pack"
           # "find_by_sql" works faster itself PLUS only a subset of all fields is selected;
           # this is the most frequent query to be executed, hence needs to be optimised
           found_instance = Contribution.find_by_sql "SELECT contributor_id, contributor_type, policy_id FROM contributions WHERE contributable_id=#{thing_id} AND contributable_type='#{thing_type}'"
@@ -432,7 +432,7 @@
   
   # checks if two users are friends
   def Authorization.is_friend?(contributor_id, user_id)
-    friendship = Friendship.find_by_sql "SELECT id FROM friendships WHERE (user_id=#{contributor_id} AND friend_id=#{user_id}) OR (user_id=#{user_id} AND friend_id=#{contributor_id}) AND accepted_at IS NOT NULL"
+    friendship = Friendship.find_by_sql "SELECT id FROM friendships WHERE ((user_id=#{contributor_id} AND friend_id=#{user_id}) OR (user_id=#{user_id} AND friend_id=#{contributor_id})) AND accepted_at IS NOT NULL"
     return(!friendship.blank?)
   end
   

Modified: branches/apace/lib/conf.rb (2169 => 2170)


--- branches/apace/lib/conf.rb	2009-04-08 14:29:13 UTC (rev 2169)
+++ branches/apace/lib/conf.rb	2009-04-08 14:41:09 UTC (rev 2170)
@@ -101,6 +101,10 @@
     self.fetch_entry('home_page_stats')
   end
 
+  def self.label_icons
+    self.fetch_entry('label_icons', {})
+  end
+
   # This method is required to create an administrator in the test fixtures
 
   def self.admins=(value)
@@ -109,9 +113,10 @@
 
 private
 
-  def self.fetch_entry(key)
+  def self.fetch_entry(key, default = nil)
     return @settings[key] if @settings[key]
     return @defaults[key] if @defaults[key]
+    default
   end
 
 end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]