browsercms_s3 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +1 -0
 - data/app/controllers/cms/content_controller.rb +22 -17
 - data/app/controllers/cms/pages_controller.rb +17 -15
 - data/app/controllers/cms/sessions_controller.rb +17 -10
 - data/app/helpers/cms/menu_helper.rb +1 -1
 - data/app/models/group.rb +13 -2
 - data/app/models/guest_user.rb +9 -3
 - data/app/models/page.rb +0 -11
 - data/app/views/cms/blocks/index.html.erb +1 -0
 - data/app/views/cms/content/show.html.erb +2 -2
 - data/browsercms.gemspec +6 -4
 - data/lib/cms/authentication/controller.rb +26 -7
 - data/public/javascripts/cms/content_library.js +36 -0
 - data/test/functional/cms/content_controller_test.rb +2 -2
 - data/test/functional/cms/pages_controller_test.rb +7 -0
 - data/test/functional/cms/sessions_controller_test.rb +26 -2
 - data/test/test_helper.rb +1 -1
 - data/test/unit/models/group_test.rb +6 -0
 - data/test/unit/models/user_test.rb +2 -2
 - metadata +3 -2
 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -50,6 +50,7 @@ The user documentation and guides for this version of the application can be fou 
     | 
|
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
            1. http://browsercms.org/doc/guides/html/index.html - User guides and manuals that cover the features and general functionality of the project. (Found locally at doc/guides/html/index.html)
         
     | 
| 
       52 
52 
     | 
    
         
             
            2. http://browsercms.org/doc/app/index.html - The RDoc API documenation (locally at doc/app/index.html)
         
     | 
| 
      
 53 
     | 
    
         
            +
            3. http://wiki.github.com/browsermedia/browsercms - The project wiki
         
     | 
| 
       53 
54 
     | 
    
         | 
| 
       54 
55 
     | 
    
         
             
            ## Modifying the source
         
     | 
| 
       55 
56 
     | 
    
         
             
            If you want to experiment with the source code, the BrowserCMS project can bootstrap itself as a web application. This allows developers who want to contribute to the project to easily alter and test changes. To run the application itself, do the following:
         
     | 
| 
         @@ -58,7 +58,7 @@ class Cms::ContentController < Cms::ApplicationController 
     | 
|
| 
       58 
58 
     | 
    
         
             
              # if caching is not enabled
         
     | 
| 
       59 
59 
     | 
    
         
             
              def render_page
         
     | 
| 
       60 
60 
     | 
    
         
             
                @_page_route.execute(self) if @_page_route
         
     | 
| 
       61 
     | 
    
         
            -
                prepare_connectables_for_render  
     | 
| 
      
 61 
     | 
    
         
            +
                prepare_connectables_for_render 
         
     | 
| 
       62 
62 
     | 
    
         
             
                render :layout => @page.layout, :action => 'show'
         
     | 
| 
       63 
63 
     | 
    
         
             
              end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
         @@ -95,7 +95,7 @@ class Cms::ContentController < Cms::ApplicationController 
     | 
|
| 
       95 
95 
     | 
    
         
             
                    @template.instance_variable_set("#{v}", nil)
         
     | 
| 
       96 
96 
     | 
    
         
             
                  end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
                  prepare_connectables_for_render 
     | 
| 
      
 98 
     | 
    
         
            +
                  prepare_connectables_for_render
         
     | 
| 
       99 
99 
     | 
    
         
             
                  render :layout => @page.layout, :template => 'cms/content/show', :status => status
         
     | 
| 
       100 
100 
     | 
    
         
             
                else
         
     | 
| 
       101 
101 
     | 
    
         
             
                  handle_server_error(exception)
         
     | 
| 
         @@ -105,23 +105,28 @@ class Cms::ContentController < Cms::ApplicationController 
     | 
|
| 
       105 
105 
     | 
    
         
             
              # If any of the page's connectables (portlets, etc) are renderable, they may have a render method
         
     | 
| 
       106 
106 
     | 
    
         
             
              # which does "controller" stuff, so we need to get that run before rendering the page.
         
     | 
| 
       107 
107 
     | 
    
         
             
              def prepare_connectables_for_render
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                @page. 
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                   
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                     
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                       
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                @_connectors = @page.connectors.for_page_version(@page.version)
         
     | 
| 
      
 110 
     | 
    
         
            +
                @_connectables = @_connectors.map(&:connectable_with_deleted)
         
     | 
| 
      
 111 
     | 
    
         
            +
                unless (logged_in? && current_user.able_to?(:administrate, :edit_content, :publish_content))
         
     | 
| 
      
 112 
     | 
    
         
            +
                  worst_exception = nil
         
     | 
| 
      
 113 
     | 
    
         
            +
                  @_connectables.each do |c|
         
     | 
| 
      
 114 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 115 
     | 
    
         
            +
                      c.prepare_to_render(self) 
         
     | 
| 
      
 116 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 117 
     | 
    
         
            +
                      logger.debug "THROWN EXCEPTION by connectable #{c}: #{$!}"
         
     | 
| 
      
 118 
     | 
    
         
            +
                      case $!
         
     | 
| 
      
 119 
     | 
    
         
            +
                      when ActiveRecord::RecordNotFound
         
     | 
| 
      
 120 
     | 
    
         
            +
                        raise
         
     | 
| 
      
 121 
     | 
    
         
            +
                      when Cms::Errors::AccessDenied
         
     | 
| 
      
 122 
     | 
    
         
            +
                        worst_exception = $!
         
     | 
| 
      
 123 
     | 
    
         
            +
                      else
         
     | 
| 
      
 124 
     | 
    
         
            +
                        c.render_exception = $!
         
     | 
| 
      
 125 
     | 
    
         
            +
                      end
         
     | 
| 
       121 
126 
     | 
    
         
             
                    end
         
     | 
| 
       122 
127 
     | 
    
         
             
                  end
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                 
     | 
| 
      
 128 
     | 
    
         
            +
                  raise worst_exception if worst_exception
         
     | 
| 
      
 129 
     | 
    
         
            +
                end 
         
     | 
| 
       125 
130 
     | 
    
         
             
              end 
         
     | 
| 
       126 
131 
     | 
    
         | 
| 
       127 
132 
     | 
    
         
             
              # ----- Before Filters -------------------------------------------------------
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Cms::PagesController < Cms::BaseController
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
             
         
     | 
| 
       3 
3 
     | 
    
         
             
              before_filter :set_toolbar_tab
         
     | 
| 
       4 
4 
     | 
    
         
             
              before_filter :load_section, :only => [:new, :create]
         
     | 
| 
       5 
5 
     | 
    
         
             
              before_filter :load_page, :only => [:versions, :version, :revert_to, :destroy]
         
     | 
| 
         @@ -18,7 +18,7 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       18 
18 
     | 
    
         
             
              def show
         
     | 
| 
       19 
19 
     | 
    
         
             
                redirect_to Page.find(params[:id]).path
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
         
     | 
| 
       22 
22 
     | 
    
         
             
              def create
         
     | 
| 
       23 
23 
     | 
    
         
             
                @page = Page.new(params[:page])
         
     | 
| 
       24 
24 
     | 
    
         
             
                @page.section = @section
         
     | 
| 
         @@ -38,7 +38,7 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  render :action => "edit"
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
       40 
40 
     | 
    
         
             
              rescue ActiveRecord::StaleObjectError => e
         
     | 
| 
       41 
     | 
    
         
            -
                @other_version = @page.class.find(@page.id) 
     | 
| 
      
 41 
     | 
    
         
            +
                @other_version = @page.class.find(@page.id)
         
     | 
| 
       42 
42 
     | 
    
         
             
                render :action => "edit"
         
     | 
| 
       43 
43 
     | 
    
         
             
              end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
         @@ -55,7 +55,7 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       55 
55 
     | 
    
         
             
                  end
         
     | 
| 
       56 
56 
     | 
    
         
             
                end
         
     | 
| 
       57 
57 
     | 
    
         
             
              end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
             
         
     | 
| 
       59 
59 
     | 
    
         
             
              #status actions
         
     | 
| 
       60 
60 
     | 
    
         
             
              {:publish => "published", :hide => "hidden", :archive => "archived"}.each do |status, verb|
         
     | 
| 
       61 
61 
     | 
    
         
             
                define_method status do
         
     | 
| 
         @@ -74,25 +74,27 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       74 
74 
     | 
    
         
             
                  end
         
     | 
| 
       75 
75 
     | 
    
         
             
                end
         
     | 
| 
       76 
76 
     | 
    
         
             
              end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 77 
     | 
    
         
            +
             
         
     | 
| 
       78 
78 
     | 
    
         
             
              def version
         
     | 
| 
       79 
79 
     | 
    
         
             
                @page = @page.as_of_version(params[:version])
         
     | 
| 
       80 
80 
     | 
    
         
             
                @show_toolbar = true
         
     | 
| 
       81 
81 
     | 
    
         
             
                @show_page_toolbar = true
         
     | 
| 
      
 82 
     | 
    
         
            +
                @_connectors = @page.connectors.for_page_version(@page.version)
         
     | 
| 
      
 83 
     | 
    
         
            +
                @_connectables = @_connectors.map(&:connectable_with_deleted)   
         
     | 
| 
       82 
84 
     | 
    
         
             
                render :layout => @page.layout, :template => 'cms/content/show'
         
     | 
| 
       83 
     | 
    
         
            -
              end 
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
              end 
         
     | 
| 
      
 86 
     | 
    
         
            +
             
         
     | 
| 
       85 
87 
     | 
    
         
             
              def revert_to
         
     | 
| 
       86 
88 
     | 
    
         
             
                if @page.revert_to(params[:version])
         
     | 
| 
       87 
89 
     | 
    
         
             
                  flash[:notice] = "Page '#{@page.name}' was reverted to version #{params[:version]}"
         
     | 
| 
       88 
90 
     | 
    
         
             
                end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
      
 91 
     | 
    
         
            +
               
         
     | 
| 
       90 
92 
     | 
    
         
             
                respond_to do |format|
         
     | 
| 
       91 
93 
     | 
    
         
             
                  format.html { redirect_to @page.path }
         
     | 
| 
       92 
94 
     | 
    
         
             
                  format.js { render :template => 'cms/shared/show_notice' }
         
     | 
| 
       93 
     | 
    
         
            -
                end 
     | 
| 
      
 95 
     | 
    
         
            +
                end   
         
     | 
| 
       94 
96 
     | 
    
         
             
              end
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
      
 97 
     | 
    
         
            +
             
         
     | 
| 
       96 
98 
     | 
    
         
             
              private
         
     | 
| 
       97 
99 
     | 
    
         
             
                def strip_publish_params
         
     | 
| 
       98 
100 
     | 
    
         
             
                  unless current_user.able_to?(:publish_content)
         
     | 
| 
         @@ -105,17 +107,17 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       105 
107 
     | 
    
         
             
                  @page = Page.find(params[:id])
         
     | 
| 
       106 
108 
     | 
    
         
             
                  raise Cms::Errors::AccessDenied unless current_user.able_to_edit?(@page)
         
     | 
| 
       107 
109 
     | 
    
         
             
                end
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
               
         
     | 
| 
       109 
111 
     | 
    
         
             
                def load_draft_page
         
     | 
| 
       110 
112 
     | 
    
         
             
                  load_page
         
     | 
| 
       111 
113 
     | 
    
         
             
                  @page = @page.as_of_draft_version
         
     | 
| 
       112 
114 
     | 
    
         
             
                end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
      
 115 
     | 
    
         
            +
             
         
     | 
| 
       114 
116 
     | 
    
         
             
                def load_section
         
     | 
| 
       115 
117 
     | 
    
         
             
                  @section = Section.find(params[:section_id])
         
     | 
| 
       116 
118 
     | 
    
         
             
                  raise Cms::Errors::AccessDenied unless current_user.able_to_edit?(@section)
         
     | 
| 
       117 
119 
     | 
    
         
             
                end
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 120 
     | 
    
         
            +
               
         
     | 
| 
       119 
121 
     | 
    
         
             
                def hide_toolbar
         
     | 
| 
       120 
122 
     | 
    
         
             
                  @hide_page_toolbar = true
         
     | 
| 
       121 
123 
     | 
    
         
             
                end
         
     | 
| 
         @@ -123,9 +125,9 @@ class Cms::PagesController < Cms::BaseController 
     | 
|
| 
       123 
125 
     | 
    
         
             
                def set_toolbar_tab
         
     | 
| 
       124 
126 
     | 
    
         
             
                  @toolbar_tab = :sitemap
         
     | 
| 
       125 
127 
     | 
    
         
             
                end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
      
 128 
     | 
    
         
            +
               
         
     | 
| 
       127 
129 
     | 
    
         
             
                def load_templates
         
     | 
| 
       128 
130 
     | 
    
         
             
                  @templates = PageTemplate.options
         
     | 
| 
       129 
131 
     | 
    
         
             
                end
         
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
      
 132 
     | 
    
         
            +
               
         
     | 
| 
       131 
133 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,11 +3,11 @@ class Cms::SessionsController < Cms::ApplicationController 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
              before_filter :redirect_to_cms_site, :only => [:new]
         
     | 
| 
       5 
5 
     | 
    
         
             
              layout "cms/login"
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       7 
7 
     | 
    
         
             
              def new
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       11 
11 
     | 
    
         
             
              def create
         
     | 
| 
       12 
12 
     | 
    
         
             
                logout_keeping_session!
         
     | 
| 
       13 
13 
     | 
    
         
             
                user = User.authenticate(params[:login], params[:password])
         
     | 
| 
         @@ -21,7 +21,7 @@ class Cms::SessionsController < Cms::ApplicationController 
     | 
|
| 
       21 
21 
     | 
    
         
             
                  handle_remember_cookie! new_cookie_flag
         
     | 
| 
       22 
22 
     | 
    
         
             
                  flash[:notice] = "Logged in successfully"
         
     | 
| 
       23 
23 
     | 
    
         
             
                  if params[:success_url] # Coming from login portlet
         
     | 
| 
       24 
     | 
    
         
            -
                    redirect_to( 
     | 
| 
      
 24 
     | 
    
         
            +
                    redirect_to((!params[:success_url].blank? && params[:success_url]) || session[:return_to] || "/")
         
     | 
| 
       25 
25 
     | 
    
         
             
                    session[:return_to] = nil
         
     | 
| 
       26 
26 
     | 
    
         
             
                  else
         
     | 
| 
       27 
27 
     | 
    
         
             
                    redirect_back_or_default(cms_home_url)
         
     | 
| 
         @@ -30,7 +30,7 @@ class Cms::SessionsController < Cms::ApplicationController 
     | 
|
| 
       30 
30 
     | 
    
         
             
                  note_failed_signin
         
     | 
| 
       31 
31 
     | 
    
         
             
                  @login       = params[:login]
         
     | 
| 
       32 
32 
     | 
    
         
             
                  @remember_me = params[:remember_me]
         
     | 
| 
       33 
     | 
    
         
            -
                  flash[:login_error] = "Log in failed" 
     | 
| 
      
 33 
     | 
    
         
            +
                  flash[:login_error] = "Log in failed"
         
     | 
| 
       34 
34 
     | 
    
         
             
                  if params[:success_url] # Coming from login portlet
         
     | 
| 
       35 
35 
     | 
    
         
             
                    if params[:success_url].blank?
         
     | 
| 
       36 
36 
     | 
    
         
             
                      success_url = session[:return_to] || "/"
         
     | 
| 
         @@ -42,23 +42,30 @@ class Cms::SessionsController < Cms::ApplicationController 
     | 
|
| 
       42 
42 
     | 
    
         
             
                    flash[:success_url] = success_url
         
     | 
| 
       43 
43 
     | 
    
         
             
                    redirect_to request.referrer
         
     | 
| 
       44 
44 
     | 
    
         
             
                  else
         
     | 
| 
       45 
     | 
    
         
            -
                    render :action => "new" 
     | 
| 
       46 
     | 
    
         
            -
                  end 
     | 
| 
      
 45 
     | 
    
         
            +
                    render :action => "new"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
| 
       48 
48 
     | 
    
         
             
              end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
              def destroy
         
     | 
| 
      
 51 
     | 
    
         
            +
                logout_user
         
     | 
| 
      
 52 
     | 
    
         
            +
                redirect_back_or_default("/")
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              protected
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              # Pulled this out as a separate method so that modules (like bcms_cas) can override/alias destroy and
         
     | 
| 
      
 58 
     | 
    
         
            +
              # not have a redirect happen as a side effect.
         
     | 
| 
      
 59 
     | 
    
         
            +
              def logout_user
         
     | 
| 
       51 
60 
     | 
    
         
             
                logout_killing_session!
         
     | 
| 
       52 
61 
     | 
    
         
             
                cookies.delete :openSectionNodes
         
     | 
| 
       53 
62 
     | 
    
         
             
                flash[:notice] = "You have been logged out."
         
     | 
| 
       54 
     | 
    
         
            -
                redirect_back_or_default("/")
         
     | 
| 
       55 
63 
     | 
    
         
             
              end
         
     | 
| 
       56 
64 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
            protected
         
     | 
| 
       58 
65 
     | 
    
         
             
              # Track failed login attempts
         
     | 
| 
       59 
66 
     | 
    
         
             
              def note_failed_signin
         
     | 
| 
       60 
67 
     | 
    
         
             
                flash[:error] = "Couldn't log you in as '#{params[:login]}'"
         
     | 
| 
       61 
68 
     | 
    
         
             
                logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"
         
     | 
| 
       62 
69 
     | 
    
         
             
              end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
       64 
71 
     | 
    
         
             
            end
         
     | 
| 
         @@ -22,7 +22,7 @@ module Cms 
     | 
|
| 
       22 
22 
     | 
    
         
             
                # * <tt>:children</tt> - An array of hashes containing the child menu items. This is where the
         
     | 
| 
       23 
23 
     | 
    
         
             
                #   tree structure comes in.
         
     | 
| 
       24 
24 
     | 
    
         
             
                def render_menu(options = {})
         
     | 
| 
       25 
     | 
    
         
            -
                  options[:items] ||= menu_items
         
     | 
| 
      
 25 
     | 
    
         
            +
                  options[:items] ||= menu_items(options)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  options[:partial] ||= "cms/menus/menu"
         
     | 
| 
       27 
27 
     | 
    
         
             
                  options[:id] ||= "menu"
         
     | 
| 
       28 
28 
     | 
    
         
             
                  options[:class] ||= "menu"
         
     | 
    
        data/app/models/group.rb
    CHANGED
    
    | 
         @@ -1,5 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # A group represents a collection of permissions. Each User can be assigned to one or more groups, and the sum of
         
     | 
| 
      
 3 
     | 
    
         
            +
            # their permissions from all groups combined represents what they can do.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
       1 
5 
     | 
    
         
             
            class Group < ActiveRecord::Base
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              GUEST_CODE = "guest"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       3 
9 
     | 
    
         
             
              has_many :user_group_memberships
         
     | 
| 
       4 
10 
     | 
    
         
             
              has_many :users, :through => :user_group_memberships
         
     | 
| 
       5 
11 
     | 
    
         | 
| 
         @@ -26,5 +32,10 @@ class Group < ActiveRecord::Base 
     | 
|
| 
       26 
32 
     | 
    
         
             
              def cms_access?
         
     | 
| 
       27 
33 
     | 
    
         
             
                group_type && group_type.cms_access?
         
     | 
| 
       28 
34 
     | 
    
         
             
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              # Finds the guest group, which is a special group that represents public non-logged in users.
         
     | 
| 
      
 37 
     | 
    
         
            +
              def self.guest
         
     | 
| 
      
 38 
     | 
    
         
            +
                with_code(GUEST_CODE).first
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       30 
41 
     | 
    
         
             
            end
         
     | 
    
        data/app/models/guest_user.rb
    CHANGED
    
    | 
         @@ -1,7 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Guests are a special user that represents a non-logged in user. The main reason to create an explicit
         
     | 
| 
      
 3 
     | 
    
         
            +
            # instance of this type of user is so that the permissions a Guest user can have can be set via the Admin interface.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Every request that a non-logged in user makes will use this User's permissions to determine what they can/can't do.
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
       1 
7 
     | 
    
         
             
            class GuestUser < User
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       3 
9 
     | 
    
         
             
              def initialize(attributes={})
         
     | 
| 
       4 
     | 
    
         
            -
                super({:login =>  
     | 
| 
      
 10 
     | 
    
         
            +
                super({:login => Group::GUEST_CODE, :first_name => "Anonymous", :last_name => "User"}.merge(attributes))
         
     | 
| 
       5 
11 
     | 
    
         
             
                @guest = true
         
     | 
| 
       6 
12 
     | 
    
         
             
              end
         
     | 
| 
       7 
13 
     | 
    
         | 
| 
         @@ -18,7 +24,7 @@ class GuestUser < User 
     | 
|
| 
       18 
24 
     | 
    
         
             
              end
         
     | 
| 
       19 
25 
     | 
    
         | 
| 
       20 
26 
     | 
    
         
             
              def group
         
     | 
| 
       21 
     | 
    
         
            -
                @group ||= Group. 
     | 
| 
      
 27 
     | 
    
         
            +
                @group ||= Group.guest
         
     | 
| 
       22 
28 
     | 
    
         
             
              end
         
     | 
| 
       23 
29 
     | 
    
         | 
| 
       24 
30 
     | 
    
         
             
              def groups
         
     | 
    
        data/app/models/page.rb
    CHANGED
    
    | 
         @@ -151,17 +151,6 @@ class Page < ActiveRecord::Base 
     | 
|
| 
       151 
151 
     | 
    
         
             
              def delete_connectors
         
     | 
| 
       152 
152 
     | 
    
         
             
                connectors.for_page_version(version).all.each{|c| c.destroy }
         
     | 
| 
       153 
153 
     | 
    
         
             
              end
         
     | 
| 
       154 
     | 
    
         
            -
              
         
     | 
| 
       155 
     | 
    
         
            -
              def connectables_by_connector
         
     | 
| 
       156 
     | 
    
         
            -
                @connectables_by_connector ||= connectors.for_page_version(version).inject({}) do |mem, connector|
         
     | 
| 
       157 
     | 
    
         
            -
                  connectable = connector.connectable_with_deleted
         
     | 
| 
       158 
     | 
    
         
            -
                  if connectable.class.versioned?
         
     | 
| 
       159 
     | 
    
         
            -
                    connectable = connectable.as_of_version(connector.connectable_version)
         
     | 
| 
       160 
     | 
    
         
            -
                  end
         
     | 
| 
       161 
     | 
    
         
            -
                  mem[connector] = connectable
         
     | 
| 
       162 
     | 
    
         
            -
                  mem
         
     | 
| 
       163 
     | 
    
         
            -
                end
         
     | 
| 
       164 
     | 
    
         
            -
              end
         
     | 
| 
       165 
154 
     | 
    
         | 
| 
       166 
155 
     | 
    
         
             
              #This is done to let copy_connectors know which version to pull from
         
     | 
| 
       167 
156 
     | 
    
         
             
              #copy_connectors will get called later as an after_update callback
         
     | 
| 
         @@ -12,9 +12,9 @@ 
     | 
|
| 
       12 
12 
     | 
    
         
             
              <iframe src="<%=h cms_toolbar_path(:page_id => @page.id, :page_version => @page.version, :mode => @mode, :page_toolbar => @show_page_toolbar ? 1 : 0) %>" width="100%" height="<%= @show_page_toolbar ? 159 : 100 %>px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="cms_toolbar"></iframe>
         
     | 
| 
       13 
13 
     | 
    
         
             
            <% end %>
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
            <% @ 
     | 
| 
      
 15 
     | 
    
         
            +
            <% @_connectors.each_with_index do |connector, i| %>
         
     | 
| 
       16 
16 
     | 
    
         
             
              <% content_for(connector.container.to_sym) do %>
         
     | 
| 
       17 
     | 
    
         
            -
                <%= render_connector_and_connectable(connector,  
     | 
| 
      
 17 
     | 
    
         
            +
                <%= render_connector_and_connectable(connector, @_connectables[i]) %>
         
     | 
| 
       18 
18 
     | 
    
         
             
              <% end %>
         
     | 
| 
       19 
19 
     | 
    
         
             
            <% end %> 
         
     | 
| 
       20 
20 
     | 
    
         | 
    
        data/browsercms.gemspec
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Generated by jeweler
         
     | 
| 
       2 
     | 
    
         
            -
            # DO NOT EDIT THIS FILE
         
     | 
| 
       3 
     | 
    
         
            -
            # Instead, edit Jeweler::Tasks in Rakefile, and run  
     | 
| 
      
 2 
     | 
    
         
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         
     | 
| 
      
 3 
     | 
    
         
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         
     | 
| 
       4 
4 
     | 
    
         
             
            # -*- encoding: utf-8 -*-
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{browsercms}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "3.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "3.0.5"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["BrowserMedia"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2009- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2009-11-09}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.email = %q{github@browsermedia.com}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
       15 
15 
     | 
    
         
             
                "LICENSE.txt",
         
     | 
| 
         @@ -1172,6 +1172,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       1172 
1172 
     | 
    
         
             
                 "public/images/cms/usercontrols_bg.png",
         
     | 
| 
       1173 
1173 
     | 
    
         
             
                 "public/images/cms/usercontrols_bg_cap.png",
         
     | 
| 
       1174 
1174 
     | 
    
         
             
                 "public/javascripts/cms/application.js",
         
     | 
| 
      
 1175 
     | 
    
         
            +
                 "public/javascripts/cms/content_library.js",
         
     | 
| 
       1175 
1176 
     | 
    
         
             
                 "public/javascripts/cms/editor.js",
         
     | 
| 
       1176 
1177 
     | 
    
         
             
                 "public/javascripts/cms/sitemap.js",
         
     | 
| 
       1177 
1178 
     | 
    
         
             
                 "public/javascripts/jquery-ui.js",
         
     | 
| 
         @@ -1315,3 +1316,4 @@ Gem::Specification.new do |s| 
     | 
|
| 
       1315 
1316 
     | 
    
         
             
              else
         
     | 
| 
       1316 
1317 
     | 
    
         
             
              end
         
     | 
| 
       1317 
1318 
     | 
    
         
             
            end
         
     | 
| 
      
 1319 
     | 
    
         
            +
             
     | 
| 
         @@ -1,3 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Defines the authentication behavior for controllers in BrowserCMS. It can be added to any controller that needs to 
         
     | 
| 
      
 3 
     | 
    
         
            +
            # hook into the BrowserCMS Authentication behavior like so:
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # class MySuperSecureController < ApplicationController
         
     | 
| 
      
 6 
     | 
    
         
            +
            #   include Cms::Authentication::Controller
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
            # It is based off Restful_Authentication, and adds in behavior to deal with several concepts specific to BrowserCMS.
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # (Note: 10/8/09 - I was comparing this to a very old version of the generated code from Restful_Authentication,
         
     | 
| 
      
 11 
     | 
    
         
            +
            # so some of the following items may be 'stock' to that. (Especially #2)
         
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
      
 13 
     | 
    
         
            +
            # 1. Guests - These represents users that are not logged in. What guests can see and do can be modified via the CMS UI. Guests
         
     | 
| 
      
 14 
     | 
    
         
            +
            #             are not considered to be 'logged in'.
         
     | 
| 
      
 15 
     | 
    
         
            +
            # 2. 'Current' User - The currently logged in user is stored in a thread local, and can be accessed anywhere via 'User.current'.
         
     | 
| 
      
 16 
     | 
    
         
            +
            #             This allows model code to easily record which user is making changes to records, for versioning, etc.
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
            # 3. 'Admin' Access Denied Page - If users try to access a protected controller, they are redirected to the CMS administration Login page
         
     | 
| 
      
 19 
     | 
    
         
            +
            #             which may be different than the 'front end' user login page. (Cms::Controller handles that differently)
         
     | 
| 
      
 20 
     | 
    
         
            +
            #
         
     | 
| 
      
 21 
     | 
    
         
            +
            #
         
     | 
| 
      
 22 
     | 
    
         
            +
            # To Dos: It appears as though we are storing the 'current' user in two places, @current_user and User.current. This is probably not DRY, but
         
     | 
| 
      
 23 
     | 
    
         
            +
            #   more testing would be needed.
         
     | 
| 
      
 24 
     | 
    
         
            +
            #
         
     | 
| 
       1 
25 
     | 
    
         
             
            module Cms
         
     | 
| 
       2 
26 
     | 
    
         
             
              module Authentication
         
     | 
| 
       3 
27 
     | 
    
         
             
                module Controller
         
     | 
| 
         @@ -12,6 +36,7 @@ module Cms 
     | 
|
| 
       12 
36 
     | 
    
         
             
                    # If the user is not logged in, this will be set to the guest user, which represents a public
         
     | 
| 
       13 
37 
     | 
    
         
             
                    # user, who will likely have more limited permissions
         
     | 
| 
       14 
38 
     | 
    
         
             
                    def current_user
         
     | 
| 
      
 39 
     | 
    
         
            +
                      # Note: We have disabled basic_http_auth
         
     | 
| 
       15 
40 
     | 
    
         
             
                      @current_user ||= begin
         
     | 
| 
       16 
41 
     | 
    
         
             
                        User.current = (login_from_session || login_from_cookie || User.guest)  
         
     | 
| 
       17 
42 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -61,7 +86,7 @@ module Cms 
     | 
|
| 
       61 
86 
     | 
    
         | 
| 
       62 
87 
     | 
    
         
             
                    # Redirect as appropriate when an access request fails.
         
     | 
| 
       63 
88 
     | 
    
         
             
                    #
         
     | 
| 
       64 
     | 
    
         
            -
                    # The default action is to redirect to the login screen.
         
     | 
| 
      
 89 
     | 
    
         
            +
                    # The default action is to redirect to the BrowserCMS admin login screen.
         
     | 
| 
       65 
90 
     | 
    
         
             
                    #
         
     | 
| 
       66 
91 
     | 
    
         
             
                    # Override this method in your controllers if you want to have special
         
     | 
| 
       67 
92 
     | 
    
         
             
                    # behavior in case the user is not authorized
         
     | 
| 
         @@ -73,11 +98,6 @@ module Cms 
     | 
|
| 
       73 
98 
     | 
    
         
             
                          store_location
         
     | 
| 
       74 
99 
     | 
    
         
             
                          redirect_to cms_login_path
         
     | 
| 
       75 
100 
     | 
    
         
             
                        end
         
     | 
| 
       76 
     | 
    
         
            -
                        # format.any doesn't work in rails version < http://dev.rubyonrails.org/changeset/8987
         
     | 
| 
       77 
     | 
    
         
            -
                        # you may want to change format.any to e.g. format.any(:js, :xml)
         
     | 
| 
       78 
     | 
    
         
            -
                        # format.any do
         
     | 
| 
       79 
     | 
    
         
            -
                        #   request_http_basic_authentication 'Web Password'
         
     | 
| 
       80 
     | 
    
         
            -
                        # end
         
     | 
| 
       81 
101 
     | 
    
         
             
                      end
         
     | 
| 
       82 
102 
     | 
    
         
             
                    end
         
     | 
| 
       83 
103 
     | 
    
         | 
| 
         @@ -162,7 +182,6 @@ module Cms 
     | 
|
| 
       162 
182 
     | 
    
         | 
| 
       163 
183 
     | 
    
         
             
                    # Cookies shouldn't be allowed to persist past their freshness date,
         
     | 
| 
       164 
184 
     | 
    
         
             
                    # and they should be changed at each login
         
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
185 
     | 
    
         
             
                    def valid_remember_cookie?
         
     | 
| 
       167 
186 
     | 
    
         
             
                      return nil unless User.current
         
     | 
| 
       168 
187 
     | 
    
         
             
                      (User.current.remember_token?) && 
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            jQuery(function($){
         
     | 
| 
      
 2 
     | 
    
         
            +
                
         
     | 
| 
      
 3 
     | 
    
         
            +
                //----- Helper Functions -----------------------------------------------------
         
     | 
| 
      
 4 
     | 
    
         
            +
                //In all of this code, we are defining functions that we use later
         
     | 
| 
      
 5 
     | 
    
         
            +
                //None of this actually manipulates the DOM in any way
         
     | 
| 
      
 6 
     | 
    
         
            +
                
         
     | 
| 
      
 7 
     | 
    
         
            +
                //This is used to get the id part of an elementId
         
     | 
| 
      
 8 
     | 
    
         
            +
                //For example, if you have section_node_5, 
         
     | 
| 
      
 9 
     | 
    
         
            +
                //you pass this 'section_node_5', 'section_node' 
         
     | 
| 
      
 10 
     | 
    
         
            +
                //and this returns 5
         
     | 
| 
      
 11 
     | 
    
         
            +
                var getId = function(elementId, s) {
         
     | 
| 
      
 12 
     | 
    
         
            +
            	return elementId.replace(s,'')
         
     | 
| 
      
 13 
     | 
    
         
            +
                }
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                var nodeOnDoubleClick = function() {
         
     | 
| 
      
 17 
     | 
    
         
            +
            	if($('#edit_button').hasClass('disabled')) {
         
     | 
| 
      
 18 
     | 
    
         
            +
            	    //$('#view_button').click()
         
     | 
| 
      
 19 
     | 
    
         
            +
            	    location.href = $('#view_button')[0].href
         
     | 
| 
      
 20 
     | 
    
         
            +
            	} else {
         
     | 
| 
      
 21 
     | 
    
         
            +
            	    //$('#edit_button').click()      
         
     | 
| 
      
 22 
     | 
    
         
            +
            	    location.href = $('#edit_button')[0].href
         
     | 
| 
      
 23 
     | 
    
         
            +
            	}
         
     | 
| 
      
 24 
     | 
    
         
            +
                }
         
     | 
| 
      
 25 
     | 
    
         
            +
                
         
     | 
| 
      
 26 
     | 
    
         
            +
                var addNodeOnDoubleClick = function() {
         
     | 
| 
      
 27 
     | 
    
         
            +
            	$('#blocks tr').dblclick(nodeOnDoubleClick)
         
     | 
| 
      
 28 
     | 
    
         
            +
                }
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                //----- Init -----------------------------------------------------------------
         
     | 
| 
      
 31 
     | 
    
         
            +
                //In other words, stuff that happens when the page loads
         
     | 
| 
      
 32 
     | 
    
         
            +
                //This is where we actually manipulate the DOM, fire events, etc.
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
                addNodeOnDoubleClick()
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            })
         
     | 
| 
         @@ -230,7 +230,7 @@ class Cms::ContentCachingEnabledControllerTest < ActionController::TestCase 
     | 
|
| 
       230 
230 
     | 
    
         
             
                ActionController::Base.perform_caching = true
         
     | 
| 
       231 
231 
     | 
    
         
             
                @page = Factory(:page, :section => root_section, :name => "Test Page", :path => "/page", :publish_on_save => true)
         
     | 
| 
       232 
232 
     | 
    
         
             
                @registered_user = Factory(:user)
         
     | 
| 
       233 
     | 
    
         
            -
                @registered_user.groups << Group. 
     | 
| 
      
 233 
     | 
    
         
            +
                @registered_user.groups << Group.guest
         
     | 
| 
       234 
234 
     | 
    
         
             
              end
         
     | 
| 
       235 
235 
     | 
    
         | 
| 
       236 
236 
     | 
    
         
             
              def teardown
         
     | 
| 
         @@ -315,7 +315,7 @@ class Cms::ContentCachingDisabledControllerTest < ActionController::TestCase 
     | 
|
| 
       315 
315 
     | 
    
         
             
                ActionController::Base.perform_caching = false
         
     | 
| 
       316 
316 
     | 
    
         
             
                @page = Factory(:page, :section => root_section, :name => "Test Page", :path => "/page", :publish_on_save => true)
         
     | 
| 
       317 
317 
     | 
    
         
             
                @registered_user = Factory(:user)
         
     | 
| 
       318 
     | 
    
         
            -
                @registered_user.groups << Group. 
     | 
| 
      
 318 
     | 
    
         
            +
                @registered_user.groups << Group.guest
         
     | 
| 
       319 
319 
     | 
    
         
             
              end
         
     | 
| 
       320 
320 
     | 
    
         | 
| 
       321 
321 
     | 
    
         
             
              def test_guest_user_views_page_on_public_site
         
     | 
| 
         @@ -66,6 +66,13 @@ class Cms::PagesControllerTest < ActionController::TestCase 
     | 
|
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
       67 
67 
     | 
    
         
             
              end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
      
 69 
     | 
    
         
            +
             def test_version
         
     | 
| 
      
 70 
     | 
    
         
            +
                create_page
         
     | 
| 
      
 71 
     | 
    
         
            +
                @page.update_attributes(:name => "V2")
         
     | 
| 
      
 72 
     | 
    
         
            +
                get :version, :id => @page.to_param, :version => 1
         
     | 
| 
      
 73 
     | 
    
         
            +
                assert_response :success
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       69 
76 
     | 
    
         
             
              def test_revert_to
         
     | 
| 
       70 
77 
     | 
    
         
             
                create_page
         
     | 
| 
       71 
78 
     | 
    
         
             
                @page.update_attributes(:name => "V2")
         
     | 
| 
         @@ -2,6 +2,9 @@ require File.join(File.dirname(__FILE__), '/../../test_helper') 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            class Cms::SessionsControllerTest < ActionController::TestCase
         
     | 
| 
       4 
4 
     | 
    
         
             
              include Cms::ControllerTestHelper
         
     | 
| 
      
 5 
     | 
    
         
            +
              def teardown
         
     | 
| 
      
 6 
     | 
    
         
            +
                User.current = nil
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
       5 
8 
     | 
    
         | 
| 
       6 
9 
     | 
    
         
             
              def test_not_redirected_to_cms_site_if_public_site
         
     | 
| 
       7 
10 
     | 
    
         
             
                @request.host = "foo.com"
         
     | 
| 
         @@ -19,6 +22,22 @@ class Cms::SessionsControllerTest < ActionController::TestCase 
     | 
|
| 
       19 
22 
     | 
    
         
             
                assert_select "title", "CMS Login"
         
     | 
| 
       20 
23 
     | 
    
         
             
              end
         
     | 
| 
       21 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
              def test_return_to
         
     | 
| 
      
 26 
     | 
    
         
            +
                user = Factory(:user)
         
     | 
| 
      
 27 
     | 
    
         
            +
                expected_url = "/expected_url"
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                post :create, {:success_url => "", :login => user.login, :password => "password"}, {:return_to => expected_url }
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_redirected_to(expected_url)
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              def test_success_url_overrides_return_to
         
     | 
| 
      
 33 
     | 
    
         
            +
                user = Factory(:user)
         
     | 
| 
      
 34 
     | 
    
         
            +
                expected_url = "/expected_url"
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                post :create, {:success_url => expected_url, :login => user.login, :password => "password"}, {:return_to => "/somewhere_else" }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                assert_redirected_to(expected_url)
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
              
         
     | 
| 
       22 
41 
     | 
    
         
             
            end
         
     | 
| 
       23 
42 
     | 
    
         | 
| 
       24 
43 
     | 
    
         
             
            class Cms::SessionsControllerCacheEnabledTest < ActionController::TestCase
         
     | 
| 
         @@ -48,5 +67,10 @@ class Cms::SessionsControllerCacheEnabledTest < ActionController::TestCase 
     | 
|
| 
       48 
67 
     | 
    
         
             
                log @response.body
         
     | 
| 
       49 
68 
     | 
    
         
             
                assert_select "title", "CMS Login"
         
     | 
| 
       50 
69 
     | 
    
         
             
              end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              test "destroy" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                Cms::SessionsController.any_instance.expects(:logout_user)
         
     | 
| 
      
 73 
     | 
    
         
            +
                delete :destroy
         
     | 
| 
      
 74 
     | 
    
         
            +
                assert_redirected_to "/" 
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     | 
    
        data/test/test_helper.rb
    CHANGED
    
    
| 
         @@ -4,4 +4,10 @@ class GroupTest < ActiveSupport::TestCase 
     | 
|
| 
       4 
4 
     | 
    
         
             
              def test_valid
         
     | 
| 
       5 
5 
     | 
    
         
             
                assert Factory.build(:group).valid?
         
     | 
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              test "Find guest group via method" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                expected = Group.find_by_code(Group::GUEST_CODE)
         
     | 
| 
      
 10 
     | 
    
         
            +
                assert_not_nil expected, "Validates that our fixture code is loading a guest user into the database."
         
     | 
| 
      
 11 
     | 
    
         
            +
                assert_equal expected, Group.guest
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
       7 
13 
     | 
    
         
             
            end
         
     | 
| 
         @@ -72,7 +72,7 @@ end 
     | 
|
| 
       72 
72 
     | 
    
         
             
            class UserPermissionsTest < ActiveSupport::TestCase
         
     | 
| 
       73 
73 
     | 
    
         
             
              def setup
         
     | 
| 
       74 
74 
     | 
    
         
             
                @user = Factory(:user)
         
     | 
| 
       75 
     | 
    
         
            -
                @guest_group = Group. 
     | 
| 
      
 75 
     | 
    
         
            +
                @guest_group = Group.guest
         
     | 
| 
       76 
76 
     | 
    
         
             
              end
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
              def test_user_permissions
         
     | 
| 
         @@ -210,7 +210,7 @@ end 
     | 
|
| 
       210 
210 
     | 
    
         
             
            class GuestUserTest < ActiveSupport::TestCase
         
     | 
| 
       211 
211 
     | 
    
         
             
              def setup
         
     | 
| 
       212 
212 
     | 
    
         
             
                @user = User.guest
         
     | 
| 
       213 
     | 
    
         
            -
                @guest_group = Group. 
     | 
| 
      
 213 
     | 
    
         
            +
                @guest_group = Group.guest
         
     | 
| 
       214 
214 
     | 
    
         
             
                @public_page = Factory(:page, :section => root_section)
         
     | 
| 
       215 
215 
     | 
    
         
             
                @protected_section = Factory(:section, :parent => root_section)
         
     | 
| 
       216 
216 
     | 
    
         
             
                @protected_page = Factory(:page, :section => @protected_section)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: browsercms_s3
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Anthony Underwood
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2009-10 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-11-10 00:00:00 +00:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -1179,6 +1179,7 @@ files: 
     | 
|
| 
       1179 
1179 
     | 
    
         
             
            - public/images/cms/usercontrols_bg.png
         
     | 
| 
       1180 
1180 
     | 
    
         
             
            - public/images/cms/usercontrols_bg_cap.png
         
     | 
| 
       1181 
1181 
     | 
    
         
             
            - public/javascripts/cms/application.js
         
     | 
| 
      
 1182 
     | 
    
         
            +
            - public/javascripts/cms/content_library.js
         
     | 
| 
       1182 
1183 
     | 
    
         
             
            - public/javascripts/cms/editor.js
         
     | 
| 
       1183 
1184 
     | 
    
         
             
            - public/javascripts/cms/sitemap.js
         
     | 
| 
       1184 
1185 
     | 
    
         
             
            - public/javascripts/jquery-ui.js
         
     |