browsercms 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/cms/connectors_controller.rb +1 -1
- data/app/helpers/cms/application_helper.rb +2 -19
- data/app/helpers/cms/form_builder.rb +8 -5
- data/app/helpers/cms/menu_helper.rb +19 -5
- data/app/helpers/cms/page_helper.rb +9 -1
- data/app/helpers/cms/template_support.rb +21 -0
- data/app/models/abstract_file_block.rb +4 -0
- data/app/models/connector.rb +7 -3
- data/app/models/dynamic_view.rb +2 -4
- data/app/models/portlet.rb +22 -9
- data/app/models/section.rb +7 -5
- data/app/views/cms/blocks/_toolbar_for_member.html.erb +4 -4
- data/app/views/cms/blocks/index.html.erb +1 -1
- data/app/views/cms/blocks/usages.html.erb +44 -34
- data/app/views/cms/connectors/new.html.erb +2 -2
- data/app/views/cms/dynamic_views/_form.html.erb +1 -1
- data/app/views/cms/dynamic_views/index.html.erb +7 -3
- data/app/views/cms/email_messages/index.html.erb +3 -5
- data/app/views/cms/form_builder/_cms_datetime_select.html.erb +12 -0
- data/app/views/cms/form_builder/_cms_text_editor.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_text_field.html.erb +1 -2
- data/app/views/cms/groups/_permissions.html.erb +1 -0
- data/app/views/cms/groups/_sections.html.erb +1 -0
- data/app/views/cms/groups/index.html.erb +3 -5
- data/app/views/cms/page_routes/index.html.erb +13 -7
- data/app/views/cms/page_routes/show.html.erb +4 -4
- data/app/views/cms/pages/_edit_connector.html.erb +4 -1
- data/app/views/cms/pages/_edit_container.html.erb +4 -1
- data/app/views/cms/redirects/index.html.erb +12 -7
- data/app/views/cms/routes/index.html.erb +11 -7
- data/app/views/cms/sections/_form.html.erb +4 -5
- data/app/views/cms/users/_groups.html.erb +1 -0
- data/app/views/layouts/_cms_toolbar.html.erb +37 -4
- data/app/views/layouts/_page_toolbar.html.erb +2 -2
- data/browsercms.gemspec +381 -3
- data/db/demo/data.rb +2 -1
- data/doc/app/classes/AbstractFileBlock.html +146 -0
- data/doc/app/classes/ActiveRecord.html +105 -0
- data/doc/app/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html +242 -0
- data/doc/app/classes/ActiveSupport.html +111 -0
- data/doc/app/classes/ActiveSupport/Cache.html +111 -0
- data/doc/app/classes/ActiveSupport/Cache/FileStore.html +146 -0
- data/doc/app/classes/ActsAsList.html +147 -0
- data/doc/app/classes/ActsAsList/ClassMethods.html +202 -0
- data/doc/app/classes/ActsAsList/InstanceMethods.html +510 -0
- data/doc/app/classes/ApplicationController.html +119 -0
- data/doc/app/classes/ApplicationHelper.html +112 -0
- data/doc/app/classes/Attachment.html +726 -0
- data/doc/app/classes/Category.html +230 -0
- data/doc/app/classes/CategoryType.html +214 -0
- data/doc/app/classes/Cms.html +638 -0
- data/doc/app/classes/Cms/Acts.html +111 -0
- data/doc/app/classes/Cms/Acts/ContentBlock.html +146 -0
- data/doc/app/classes/Cms/Acts/ContentBlock/MacroMethods.html +165 -0
- data/doc/app/classes/Cms/Acts/ContentBlock/MacroMethods/InstanceMethods.html +140 -0
- data/doc/app/classes/Cms/ApplicationController.html +418 -0
- data/doc/app/classes/Cms/ApplicationHelper.html +814 -0
- data/doc/app/classes/Cms/AttachmentsController.html +154 -0
- data/doc/app/classes/Cms/Authentication.html +116 -0
- data/doc/app/classes/Cms/Authentication/Controller.html +702 -0
- data/doc/app/classes/Cms/Authentication/Model.html +165 -0
- data/doc/app/classes/Cms/Authentication/Model/ClassMethods.html +246 -0
- data/doc/app/classes/Cms/Authentication/Model/InstanceMethods.html +412 -0
- data/doc/app/classes/Cms/BaseController.html +113 -0
- data/doc/app/classes/Cms/Behaviors.html +235 -0
- data/doc/app/classes/Cms/Behaviors/Archiving.html +147 -0
- data/doc/app/classes/Cms/Behaviors/Archiving/InstanceMethods.html +220 -0
- data/doc/app/classes/Cms/Behaviors/Archiving/MacroMethods.html +175 -0
- data/doc/app/classes/Cms/Behaviors/Attaching.html +160 -0
- data/doc/app/classes/Cms/Behaviors/Attaching/InstanceMethods.html +670 -0
- data/doc/app/classes/Cms/Behaviors/Attaching/MacroMethods.html +188 -0
- data/doc/app/classes/Cms/Behaviors/Categorizing.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Categorizing/ClassMethods.html +105 -0
- data/doc/app/classes/Cms/Behaviors/Categorizing/InstanceMethods.html +140 -0
- data/doc/app/classes/Cms/Behaviors/Categorizing/MacroMethods.html +178 -0
- data/doc/app/classes/Cms/Behaviors/ClassMethods.html +272 -0
- data/doc/app/classes/Cms/Behaviors/Connecting.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Connecting/ClassMethods.html +188 -0
- data/doc/app/classes/Cms/Behaviors/Connecting/InstanceMethods.html +312 -0
- data/doc/app/classes/Cms/Behaviors/Connecting/MacroMethods.html +184 -0
- data/doc/app/classes/Cms/Behaviors/DynamicAttributes.html +285 -0
- data/doc/app/classes/Cms/Behaviors/DynamicAttributes/InstanceMethods.html +181 -0
- data/doc/app/classes/Cms/Behaviors/DynamicAttributes/MacroMethods.html +243 -0
- data/doc/app/classes/Cms/Behaviors/FlushCacheOnChange.html +178 -0
- data/doc/app/classes/Cms/Behaviors/FlushCacheOnChange/InstanceMethods.html +142 -0
- data/doc/app/classes/Cms/Behaviors/FlushCacheOnChange/MacroMethods.html +175 -0
- data/doc/app/classes/Cms/Behaviors/Hiding.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Hiding/ClassMethods.html +105 -0
- data/doc/app/classes/Cms/Behaviors/Hiding/InstanceMethods.html +220 -0
- data/doc/app/classes/Cms/Behaviors/Hiding/MacroMethods.html +176 -0
- data/doc/app/classes/Cms/Behaviors/InstanceMethods.html +234 -0
- data/doc/app/classes/Cms/Behaviors/Pagination.html +151 -0
- data/doc/app/classes/Cms/Behaviors/Pagination/ClassMethods.html +252 -0
- data/doc/app/classes/Cms/Behaviors/Pagination/Collection.html +437 -0
- data/doc/app/classes/Cms/Behaviors/Pagination/InvalidPage.html +146 -0
- data/doc/app/classes/Cms/Behaviors/Publishing.html +179 -0
- data/doc/app/classes/Cms/Behaviors/Publishing/ClassMethods.html +105 -0
- data/doc/app/classes/Cms/Behaviors/Publishing/InstanceMethods.html +333 -0
- data/doc/app/classes/Cms/Behaviors/Publishing/MacroMethods.html +180 -0
- data/doc/app/classes/Cms/Behaviors/Rendering.html +179 -0
- data/doc/app/classes/Cms/Behaviors/Rendering/MacroMethods.html +186 -0
- data/doc/app/classes/Cms/Behaviors/Searching.html +147 -0
- data/doc/app/classes/Cms/Behaviors/Searching/ClassMethods.html +164 -0
- data/doc/app/classes/Cms/Behaviors/Searching/MacroMethods.html +188 -0
- data/doc/app/classes/Cms/Behaviors/SoftDeleting.html +148 -0
- data/doc/app/classes/Cms/Behaviors/SoftDeleting/ClassMethods.html +217 -0
- data/doc/app/classes/Cms/Behaviors/SoftDeleting/InstanceMethods.html +247 -0
- data/doc/app/classes/Cms/Behaviors/SoftDeleting/MacroMethods.html +205 -0
- data/doc/app/classes/Cms/Behaviors/Taggable.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Taggable/ClassMethods.html +164 -0
- data/doc/app/classes/Cms/Behaviors/Taggable/InstanceMethods.html +197 -0
- data/doc/app/classes/Cms/Behaviors/Taggable/MacroMethods.html +182 -0
- data/doc/app/classes/Cms/Behaviors/Userstamping.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Userstamping/ClassMethods.html +105 -0
- data/doc/app/classes/Cms/Behaviors/Userstamping/InstanceMethods.html +143 -0
- data/doc/app/classes/Cms/Behaviors/Userstamping/MacroMethods.html +181 -0
- data/doc/app/classes/Cms/Behaviors/Versioning.html +148 -0
- data/doc/app/classes/Cms/Behaviors/Versioning/ClassMethods.html +237 -0
- data/doc/app/classes/Cms/Behaviors/Versioning/InstanceMethods.html +685 -0
- data/doc/app/classes/Cms/Behaviors/Versioning/MacroMethods.html +290 -0
- data/doc/app/classes/Cms/CacheController.html +174 -0
- data/doc/app/classes/Cms/Caching.html +171 -0
- data/doc/app/classes/Cms/CategoriesController.html +113 -0
- data/doc/app/classes/Cms/CategoryTypesController.html +148 -0
- data/doc/app/classes/Cms/ConnectorsController.html +215 -0
- data/doc/app/classes/Cms/ContentBlockController.html +1175 -0
- data/doc/app/classes/Cms/ContentController.html +313 -0
- data/doc/app/classes/Cms/ContentTypesController.html +148 -0
- data/doc/app/classes/Cms/DashboardController.html +151 -0
- data/doc/app/classes/Cms/DataLoader.html +182 -0
- data/doc/app/classes/Cms/DynamicViewsController.html +359 -0
- data/doc/app/classes/Cms/EmailMessagesController.html +172 -0
- data/doc/app/classes/Cms/ErrorHandling.html +172 -0
- data/doc/app/classes/Cms/Errors.html +111 -0
- data/doc/app/classes/Cms/Errors/AccessDenied.html +146 -0
- data/doc/app/classes/Cms/Extensions.html +140 -0
- data/doc/app/classes/Cms/Extensions/ActionView.html +111 -0
- data/doc/app/classes/Cms/Extensions/ActionView/Base.html +141 -0
- data/doc/app/classes/Cms/Extensions/ActiveRecord.html +116 -0
- data/doc/app/classes/Cms/Extensions/ActiveRecord/Base.html +144 -0
- data/doc/app/classes/Cms/Extensions/ActiveRecord/Errors.html +140 -0
- data/doc/app/classes/Cms/Extensions/Hash.html +175 -0
- data/doc/app/classes/Cms/Extensions/Integer.html +146 -0
- data/doc/app/classes/Cms/Extensions/NilClass.html +212 -0
- data/doc/app/classes/Cms/Extensions/String.html +212 -0
- data/doc/app/classes/Cms/FileBlocksController.html +113 -0
- data/doc/app/classes/Cms/FormBuilder.html +312 -0
- data/doc/app/classes/Cms/FormTagHelper.html +245 -0
- data/doc/app/classes/Cms/GroupsController.html +225 -0
- data/doc/app/classes/Cms/HomeController.html +148 -0
- data/doc/app/classes/Cms/HtmlBlocksController.html +113 -0
- data/doc/app/classes/Cms/ImageBlocksController.html +113 -0
- data/doc/app/classes/Cms/LinksController.html +341 -0
- data/doc/app/classes/Cms/MenuHelper.html +330 -0
- data/doc/app/classes/Cms/PageHelper.html +292 -0
- data/doc/app/classes/Cms/PageRouteConditionsController.html +113 -0
- data/doc/app/classes/Cms/PageRouteOptionsController.html +355 -0
- data/doc/app/classes/Cms/PageRouteRequirementsController.html +113 -0
- data/doc/app/classes/Cms/PageRoutesController.html +284 -0
- data/doc/app/classes/Cms/PagesController.html +331 -0
- data/doc/app/classes/Cms/PathHelper.html +268 -0
- data/doc/app/classes/Cms/PortletController.html +150 -0
- data/doc/app/classes/Cms/PortletsController.html +301 -0
- data/doc/app/classes/Cms/RedirectsController.html +172 -0
- data/doc/app/classes/Cms/ResourceController.html +616 -0
- data/doc/app/classes/Cms/Routes.html +303 -0
- data/doc/app/classes/Cms/RoutesController.html +164 -0
- data/doc/app/classes/Cms/SectionNodesController.html +272 -0
- data/doc/app/classes/Cms/SectionNodesHelper.html +145 -0
- data/doc/app/classes/Cms/SectionsController.html +542 -0
- data/doc/app/classes/Cms/SessionsController.html +270 -0
- data/doc/app/classes/Cms/TagsController.html +152 -0
- data/doc/app/classes/Cms/TasksController.html +221 -0
- data/doc/app/classes/Cms/ToolbarController.html +153 -0
- data/doc/app/classes/Cms/UsersController.html +405 -0
- data/doc/app/classes/Connector.html +350 -0
- data/doc/app/classes/ContentType.html +448 -0
- data/doc/app/classes/ContentTypeGroup.html +111 -0
- data/doc/app/classes/DynamicPortlet.html +148 -0
- data/doc/app/classes/DynamicView.html +411 -0
- data/doc/app/classes/EmailMessage.html +228 -0
- data/doc/app/classes/EmailMessageMailer.html +150 -0
- data/doc/app/classes/EmailPagePortlet.html +184 -0
- data/doc/app/classes/FileBlock.html +202 -0
- data/doc/app/classes/Group.html +170 -0
- data/doc/app/classes/GroupPermission.html +111 -0
- data/doc/app/classes/GroupSection.html +111 -0
- data/doc/app/classes/GroupType.html +111 -0
- data/doc/app/classes/GroupTypePermission.html +111 -0
- data/doc/app/classes/GuestUser.html +347 -0
- data/doc/app/classes/HtmlBlock.html +170 -0
- data/doc/app/classes/ImageBlock.html +202 -0
- data/doc/app/classes/InitialData.html +171 -0
- data/doc/app/classes/Link.html +249 -0
- data/doc/app/classes/LoginPortlet.html +151 -0
- data/doc/app/classes/Page.html +954 -0
- data/doc/app/classes/PagePartial.html +201 -0
- data/doc/app/classes/PageRoute.html +335 -0
- data/doc/app/classes/PageRouteCondition.html +113 -0
- data/doc/app/classes/PageRouteOption.html +111 -0
- data/doc/app/classes/PageRouteRequirement.html +113 -0
- data/doc/app/classes/PageTemplate.html +278 -0
- data/doc/app/classes/Permission.html +111 -0
- data/doc/app/classes/Portlet.html +738 -0
- data/doc/app/classes/Redirect.html +111 -0
- data/doc/app/classes/Section.html +580 -0
- data/doc/app/classes/SectionNode.html +410 -0
- data/doc/app/classes/Sequence.html +146 -0
- data/doc/app/classes/Site.html +253 -0
- data/doc/app/classes/Tag.html +292 -0
- data/doc/app/classes/TagCloudPortlet.html +176 -0
- data/doc/app/classes/Tagging.html +146 -0
- data/doc/app/classes/Task.html +288 -0
- data/doc/app/classes/User.html +618 -0
- data/doc/app/classes/UserGroupMembership.html +111 -0
- data/doc/app/created.rid +1 -0
- data/doc/app/files/app/controllers/application_controller_rb.html +109 -0
- data/doc/app/files/app/controllers/cms/application_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/attachments_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/base_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/cache_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/categories_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/category_types_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/connectors_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/content_block_controller_rb.html +107 -0
- data/doc/app/files/app/controllers/cms/content_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/content_types_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/dashboard_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/dynamic_views_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/email_messages_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/error_handling_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/file_blocks_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/groups_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/home_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/html_blocks_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/image_blocks_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/links_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/page_route_conditions_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/page_route_options_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/page_route_requirements_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/page_routes_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/pages_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/portlet_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/portlets_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/redirects_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/resource_controller_rb.html +108 -0
- data/doc/app/files/app/controllers/cms/routes_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/section_nodes_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/sections_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/sessions_controller_rb.html +107 -0
- data/doc/app/files/app/controllers/cms/tags_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/tasks_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/toolbar_controller_rb.html +101 -0
- data/doc/app/files/app/controllers/cms/users_controller_rb.html +101 -0
- data/doc/app/files/app/helpers/application_helper_rb.html +108 -0
- data/doc/app/files/app/helpers/cms/application_helper_rb.html +107 -0
- data/doc/app/files/app/helpers/cms/form_builder_rb.html +101 -0
- data/doc/app/files/app/helpers/cms/form_tag_helper_rb.html +101 -0
- data/doc/app/files/app/helpers/cms/menu_helper_rb.html +101 -0
- data/doc/app/files/app/helpers/cms/page_helper_rb.html +101 -0
- data/doc/app/files/app/helpers/cms/path_helper_rb.html +101 -0
- data/doc/app/files/app/helpers/cms/section_nodes_helper_rb.html +101 -0
- data/doc/app/files/app/models/abstract_file_block_rb.html +101 -0
- data/doc/app/files/app/models/attachment_rb.html +109 -0
- data/doc/app/files/app/models/category_rb.html +101 -0
- data/doc/app/files/app/models/category_type_rb.html +101 -0
- data/doc/app/files/app/models/connector_rb.html +101 -0
- data/doc/app/files/app/models/content_type_group_rb.html +101 -0
- data/doc/app/files/app/models/content_type_rb.html +101 -0
- data/doc/app/files/app/models/dynamic_view_rb.html +101 -0
- data/doc/app/files/app/models/email_message_mailer_rb.html +101 -0
- data/doc/app/files/app/models/email_message_rb.html +101 -0
- data/doc/app/files/app/models/file_block_rb.html +101 -0
- data/doc/app/files/app/models/group_permission_rb.html +101 -0
- data/doc/app/files/app/models/group_rb.html +101 -0
- data/doc/app/files/app/models/group_section_rb.html +101 -0
- data/doc/app/files/app/models/group_type_permission_rb.html +101 -0
- data/doc/app/files/app/models/group_type_rb.html +101 -0
- data/doc/app/files/app/models/guest_user_rb.html +101 -0
- data/doc/app/files/app/models/html_block_rb.html +101 -0
- data/doc/app/files/app/models/image_block_rb.html +101 -0
- data/doc/app/files/app/models/link_rb.html +101 -0
- data/doc/app/files/app/models/page_partial_rb.html +101 -0
- data/doc/app/files/app/models/page_rb.html +101 -0
- data/doc/app/files/app/models/page_route_condition_rb.html +101 -0
- data/doc/app/files/app/models/page_route_option_rb.html +101 -0
- data/doc/app/files/app/models/page_route_rb.html +101 -0
- data/doc/app/files/app/models/page_route_requirement_rb.html +101 -0
- data/doc/app/files/app/models/page_template_rb.html +101 -0
- data/doc/app/files/app/models/permission_rb.html +101 -0
- data/doc/app/files/app/models/portlet_rb.html +101 -0
- data/doc/app/files/app/models/redirect_rb.html +101 -0
- data/doc/app/files/app/models/section_node_rb.html +101 -0
- data/doc/app/files/app/models/section_rb.html +101 -0
- data/doc/app/files/app/models/site_rb.html +101 -0
- data/doc/app/files/app/models/tag_rb.html +101 -0
- data/doc/app/files/app/models/tagging_rb.html +101 -0
- data/doc/app/files/app/models/task_rb.html +101 -0
- data/doc/app/files/app/models/user_group_membership_rb.html +101 -0
- data/doc/app/files/app/models/user_rb.html +108 -0
- data/doc/app/files/app/portlets/dynamic_portlet_rb.html +101 -0
- data/doc/app/files/app/portlets/email_page_portlet_rb.html +101 -0
- data/doc/app/files/app/portlets/login_portlet_rb.html +101 -0
- data/doc/app/files/app/portlets/tag_cloud_portlet_rb.html +101 -0
- data/doc/app/files/doc/README_FOR_APP.html +127 -0
- data/doc/app/files/lib/acts_as_list_rb.html +101 -0
- data/doc/app/files/lib/browsercms_rb.html +113 -0
- data/doc/app/files/lib/cms/acts/content_block_rb.html +101 -0
- data/doc/app/files/lib/cms/authentication/controller_rb.html +101 -0
- data/doc/app/files/lib/cms/authentication/model_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/archiving_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/attaching_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/categorizing_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/connecting_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/dynamic_attributes_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/flush_cache_on_change_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/hiding_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/pagination_rb.html +107 -0
- data/doc/app/files/lib/cms/behaviors/publishing_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/rendering_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/searching_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/soft_deleting_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/taggable_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/userstamping_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors/versioning_rb.html +101 -0
- data/doc/app/files/lib/cms/behaviors_rb.html +147 -0
- data/doc/app/files/lib/cms/caching_rb.html +101 -0
- data/doc/app/files/lib/cms/data_loader_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/action_view/base_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/active_record/base_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/active_record/connection_adapters/abstract/schema_statements_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/active_record/errors_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/active_support/cache/file_store_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/hash_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/integer_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/nil_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions/string_rb.html +101 -0
- data/doc/app/files/lib/cms/extensions_rb.html +101 -0
- data/doc/app/files/lib/cms/init_rb.html +101 -0
- data/doc/app/files/lib/cms/routes_rb.html +101 -0
- data/doc/app/files/lib/initial_data_rb.html +101 -0
- data/doc/app/files/lib/sequence_rb.html +101 -0
- data/doc/app/fr_class_index.html +205 -0
- data/doc/app/fr_file_index.html +152 -0
- data/doc/app/fr_method_index.html +738 -0
- data/doc/app/index.html +24 -0
- data/doc/app/rdoc-style.css +208 -0
- data/doc/guides/html/build_it_yourself.html +175 -0
- data/doc/guides/html/deployment_guide.html +181 -0
- data/doc/guides/html/designer_guide.html +153 -0
- data/doc/guides/html/developer_guide.html +266 -0
- data/doc/guides/html/files/javascripts/code_highlighter.js +188 -0
- data/doc/guides/html/files/javascripts/guides.js +7 -0
- data/doc/guides/html/files/javascripts/highlighters.js +90 -0
- data/doc/guides/html/files/stylesheets/main.css +441 -0
- data/doc/guides/html/files/stylesheets/reset.css +43 -0
- data/doc/guides/html/files/stylesheets/style.css +13 -0
- data/doc/guides/html/files/stylesheets/syntax.css +31 -0
- data/doc/guides/html/getting_started.html +181 -0
- data/doc/guides/html/images/bg.png +0 -0
- data/doc/guides/html/images/bottom_cap.png +0 -0
- data/doc/guides/html/images/browsercms_logo.png +0 -0
- data/doc/guides/html/images/dot.png +0 -0
- data/doc/guides/html/images/icons/README +5 -0
- data/doc/guides/html/images/icons/callouts/1.png +0 -0
- data/doc/guides/html/images/icons/callouts/10.png +0 -0
- data/doc/guides/html/images/icons/callouts/11.png +0 -0
- data/doc/guides/html/images/icons/callouts/12.png +0 -0
- data/doc/guides/html/images/icons/callouts/13.png +0 -0
- data/doc/guides/html/images/icons/callouts/14.png +0 -0
- data/doc/guides/html/images/icons/callouts/15.png +0 -0
- data/doc/guides/html/images/icons/callouts/2.png +0 -0
- data/doc/guides/html/images/icons/callouts/3.png +0 -0
- data/doc/guides/html/images/icons/callouts/4.png +0 -0
- data/doc/guides/html/images/icons/callouts/5.png +0 -0
- data/doc/guides/html/images/icons/callouts/6.png +0 -0
- data/doc/guides/html/images/icons/callouts/7.png +0 -0
- data/doc/guides/html/images/icons/callouts/8.png +0 -0
- data/doc/guides/html/images/icons/callouts/9.png +0 -0
- data/doc/guides/html/images/icons/caution.png +0 -0
- data/doc/guides/html/images/icons/example.png +0 -0
- data/doc/guides/html/images/icons/home.png +0 -0
- data/doc/guides/html/images/icons/important.png +0 -0
- data/doc/guides/html/images/icons/next.png +0 -0
- data/doc/guides/html/images/icons/note.png +0 -0
- data/doc/guides/html/images/icons/prev.png +0 -0
- data/doc/guides/html/images/icons/tip.png +0 -0
- data/doc/guides/html/images/icons/up.png +0 -0
- data/doc/guides/html/images/icons/warning.png +0 -0
- data/doc/guides/html/images/top_cap.png +0 -0
- data/doc/guides/html/images/top_cap_content.png +0 -0
- data/doc/guides/html/index.html +168 -0
- data/doc/guides/html/installing_modules.html +181 -0
- data/doc/guides/html/user_guide.html +266 -0
- data/lib/cms/behaviors/attaching.rb +1 -1
- data/lib/cms/behaviors/rendering.rb +1 -1
- data/lib/cms/behaviors/taggable.rb +2 -1
- data/lib/cms/behaviors/versioning.rb +1 -1
- data/lib/cms/init.rb +4 -4
- data/lib/tasks/cms.rake +16 -42
- data/public/images/cms/buttons/button_cap_off_middle.gif +0 -0
- data/public/images/cms/buttons/button_left_bg.png +0 -0
- data/public/images/cms/buttons/button_off_middle.png +0 -0
- data/public/images/cms/nav_admin.gif +0 -0
- data/public/images/cms/nav_admin_h.gif +0 -0
- data/public/images/cms/nav_admin_on.gif +0 -0
- data/public/images/cms/nav_content_library.gif +0 -0
- data/public/images/cms/nav_content_library_h.gif +0 -0
- data/public/images/cms/nav_content_library_on.gif +0 -0
- data/public/images/cms/nav_dash.gif +0 -0
- data/public/images/cms/nav_dash_h.gif +0 -0
- data/public/images/cms/nav_dash_on.gif +0 -0
- data/public/images/cms/nav_sitemap.gif +0 -0
- data/public/images/cms/nav_sitemap_h.gif +0 -0
- data/public/images/cms/nav_sitemap_on.gif +0 -0
- data/public/stylesheets/cms/administration.css +91 -91
- data/public/stylesheets/cms/block.css +25 -25
- data/public/stylesheets/cms/buttons.css +120 -111
- data/public/stylesheets/cms/content_library.css +2 -1
- data/public/stylesheets/cms/content_types.css +3 -3
- data/public/stylesheets/cms/dashboard.css +118 -118
- data/public/stylesheets/cms/data_table.css +155 -155
- data/public/stylesheets/cms/form_layout.css +269 -269
- data/public/stylesheets/cms/jquery.contextMenu.css +61 -61
- data/public/stylesheets/cms/login.css +77 -77
- data/public/stylesheets/cms/menu.css +116 -116
- data/public/stylesheets/cms/nav.css +98 -111
- data/public/stylesheets/cms/page_toolbar.css +134 -134
- data/public/stylesheets/cms/sitemap.css +31 -15
- data/rails_generators/content_block/content_block_generator.rb +4 -9
- data/rails_generators/content_block/templates/_form.html.erb +3 -1
- data/rails_generators/portlet/portlet_generator.rb +2 -6
- data/rails_generators/portlet/templates/_form.html.erb +1 -0
- data/templates/blank.rb +30 -0
- data/templates/demo.rb +28 -0
- data/templates/module.rb +945 -0
- data/test/functional/cms/connectors_controller_test.rb +12 -1
- data/test/functional/cms/portlets_controller_test.rb +10 -0
- data/test/unit/behaviors/taggable_test.rb +19 -0
- data/test/unit/helpers/menu_helper_test.rb +72 -1
- data/test/unit/lib/generators_test.rb +21 -3
- data/test/unit/models/connector_test.rb +16 -0
- data/test/unit/models/sections_test.rb +4 -0
- metadata +380 -2
@@ -0,0 +1,154 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Cms::AttachmentsController</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Cms::AttachmentsController</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/app/controllers/cms/attachments_controller_rb.html">
|
59
|
+
app/controllers/cms/attachments_controller.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="BaseController.html">
|
69
|
+
Cms::BaseController
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000617">show</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000617" class="method-detail">
|
114
|
+
<a name="M000617"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000617" class="method-signature">
|
118
|
+
<span class="method-name">show</span><span class="method-args">()</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000617-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000617-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File app/controllers/cms/attachments_controller.rb, line 2</span>
|
128
|
+
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>
|
129
|
+
3: <span class="ruby-ivar">@attachment</span> = <span class="ruby-constant">Attachment</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
|
130
|
+
4: <span class="ruby-ivar">@attachment</span> = <span class="ruby-ivar">@attachment</span>.<span class="ruby-identifier">as_of_version</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]
|
131
|
+
5: <span class="ruby-identifier">send_file</span>(<span class="ruby-ivar">@attachment</span>.<span class="ruby-identifier">full_file_location</span>,
|
132
|
+
6: <span class="ruby-identifier">:filename</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@attachment</span>.<span class="ruby-identifier">file_name</span>,
|
133
|
+
7: <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@attachment</span>.<span class="ruby-identifier">file_type</span>,
|
134
|
+
8: <span class="ruby-identifier">:disposition</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"inline"</span>
|
135
|
+
9: )
|
136
|
+
10: <span class="ruby-keyword kw">end</span>
|
137
|
+
</pre>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
|
149
|
+
<div id="validator-badges">
|
150
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
</body>
|
154
|
+
</html>
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Cms::Authentication</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Cms::Authentication</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/cms/authentication/controller_rb.html">
|
59
|
+
lib/cms/authentication/controller.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/cms/authentication/model_rb.html">
|
63
|
+
lib/cms/authentication/model.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<!-- banner header -->
|
72
|
+
|
73
|
+
<div id="bodyContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
<!-- if includes -->
|
88
|
+
|
89
|
+
<div id="section">
|
90
|
+
|
91
|
+
<div id="class-list">
|
92
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
93
|
+
|
94
|
+
Module <a href="Authentication/Controller.html" class="link">Cms::Authentication::Controller</a><br />
|
95
|
+
Module <a href="Authentication/Model.html" class="link">Cms::Authentication::Model</a><br />
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if method_list -->
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<div id="validator-badges">
|
112
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</body>
|
116
|
+
</html>
|
@@ -0,0 +1,702 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Cms::Authentication::Controller</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Cms::Authentication::Controller</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/cms/authentication/controller_rb.html">
|
59
|
+
lib/cms/authentication/controller.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000288">access_denied</a>
|
84
|
+
<a href="#M000286">authorized?</a>
|
85
|
+
<a href="#M000284">current_user</a>
|
86
|
+
<a href="#M000285">current_user=</a>
|
87
|
+
<a href="#M000298">handle_remember_cookie!</a>
|
88
|
+
<a href="#M000291">included</a>
|
89
|
+
<a href="#M000299">kill_remember_cookie!</a>
|
90
|
+
<a href="#M000283">logged_in?</a>
|
91
|
+
<a href="#M000293">login_from_basic_auth</a>
|
92
|
+
<a href="#M000294">login_from_cookie</a>
|
93
|
+
<a href="#M000292">login_from_session</a>
|
94
|
+
<a href="#M000287">login_required</a>
|
95
|
+
<a href="#M000295">logout_keeping_session!</a>
|
96
|
+
<a href="#M000296">logout_killing_session!</a>
|
97
|
+
<a href="#M000290">redirect_back_or_default</a>
|
98
|
+
<a href="#M000300">send_remember_cookie!</a>
|
99
|
+
<a href="#M000289">store_location</a>
|
100
|
+
<a href="#M000297">valid_remember_cookie?</a>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
|
109
|
+
<div id="section">
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if method_list -->
|
119
|
+
<div id="methods">
|
120
|
+
<h3 class="section-bar">Protected Class methods</h3>
|
121
|
+
|
122
|
+
<div id="method-M000291" class="method-detail">
|
123
|
+
<a name="M000291"></a>
|
124
|
+
|
125
|
+
<div class="method-heading">
|
126
|
+
<a href="#M000291" class="method-signature">
|
127
|
+
<span class="method-name">included</span><span class="method-args">(base)</span>
|
128
|
+
</a>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div class="method-description">
|
132
|
+
<p>
|
133
|
+
Inclusion hook to make <a href="Controller.html#M000284">current_user</a>
|
134
|
+
and logged_in? available as ActionView helper methods.
|
135
|
+
</p>
|
136
|
+
<p><a class="source-toggle" href="#"
|
137
|
+
onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
|
138
|
+
<div class="method-source-code" id="M000291-source">
|
139
|
+
<pre>
|
140
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 101</span>
|
141
|
+
101: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
|
142
|
+
102: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:helper_method</span>, <span class="ruby-identifier">:current_user</span>, <span class="ruby-identifier">:logged_in?</span>, <span class="ruby-identifier">:authorized?</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:helper_method</span>
|
143
|
+
103: <span class="ruby-keyword kw">end</span>
|
144
|
+
</pre>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
150
|
+
|
151
|
+
<div id="method-M000288" class="method-detail">
|
152
|
+
<a name="M000288"></a>
|
153
|
+
|
154
|
+
<div class="method-heading">
|
155
|
+
<a href="#M000288" class="method-signature">
|
156
|
+
<span class="method-name">access_denied</span><span class="method-args">()</span>
|
157
|
+
</a>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<div class="method-description">
|
161
|
+
<p>
|
162
|
+
<a href="../../Redirect.html">Redirect</a> as appropriate when an access
|
163
|
+
request fails.
|
164
|
+
</p>
|
165
|
+
<p>
|
166
|
+
The default action is to redirect to the login screen.
|
167
|
+
</p>
|
168
|
+
<p>
|
169
|
+
Override this method in your controllers if you want to have special
|
170
|
+
behavior in case the user is not authorized to access the requested action.
|
171
|
+
For example, a popup window might simply close itself.
|
172
|
+
</p>
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000288-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000288-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 69</span>
|
178
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">access_denied</span>
|
179
|
+
70: <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
|
180
|
+
71: <span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> <span class="ruby-keyword kw">do</span>
|
181
|
+
72: <span class="ruby-identifier">store_location</span>
|
182
|
+
73: <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">cms_login_path</span>
|
183
|
+
74: <span class="ruby-keyword kw">end</span>
|
184
|
+
75: <span class="ruby-comment cmt"># format.any doesn't work in rails version < http://dev.rubyonrails.org/changeset/8987</span>
|
185
|
+
76: <span class="ruby-comment cmt"># you may want to change format.any to e.g. format.any(:js, :xml)</span>
|
186
|
+
77: <span class="ruby-comment cmt"># format.any do</span>
|
187
|
+
78: <span class="ruby-comment cmt"># request_http_basic_authentication 'Web Password'</span>
|
188
|
+
79: <span class="ruby-comment cmt"># end</span>
|
189
|
+
80: <span class="ruby-keyword kw">end</span>
|
190
|
+
81: <span class="ruby-keyword kw">end</span>
|
191
|
+
</pre>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div id="method-M000286" class="method-detail">
|
197
|
+
<a name="M000286"></a>
|
198
|
+
|
199
|
+
<div class="method-heading">
|
200
|
+
<a href="#M000286" class="method-signature">
|
201
|
+
<span class="method-name">authorized?</span><span class="method-args">(action=nil, resource=nil, *args)</span>
|
202
|
+
</a>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div class="method-description">
|
206
|
+
<p>
|
207
|
+
Check if the user is authorized
|
208
|
+
</p>
|
209
|
+
<p>
|
210
|
+
Override this method in your controllers if you want to restrict access to
|
211
|
+
only a few actions or if you want to check if the user has the correct
|
212
|
+
rights.
|
213
|
+
</p>
|
214
|
+
<p>
|
215
|
+
Example:
|
216
|
+
</p>
|
217
|
+
<pre>
|
218
|
+
# only allow nonbobs
|
219
|
+
def authorized?
|
220
|
+
current_user.login != "bob"
|
221
|
+
end
|
222
|
+
</pre>
|
223
|
+
<p><a class="source-toggle" href="#"
|
224
|
+
onclick="toggleCode('M000286-source');return false;">[Source]</a></p>
|
225
|
+
<div class="method-source-code" id="M000286-source">
|
226
|
+
<pre>
|
227
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 39</span>
|
228
|
+
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authorized?</span>(<span class="ruby-identifier">action</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">resource</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
229
|
+
40: <span class="ruby-identifier">logged_in?</span>
|
230
|
+
41: <span class="ruby-keyword kw">end</span>
|
231
|
+
</pre>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div id="method-M000284" class="method-detail">
|
237
|
+
<a name="M000284"></a>
|
238
|
+
|
239
|
+
<div class="method-heading">
|
240
|
+
<a href="#M000284" class="method-signature">
|
241
|
+
<span class="method-name">current_user</span><span class="method-args">()</span>
|
242
|
+
</a>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="method-description">
|
246
|
+
<p>
|
247
|
+
Accesses the current user from the session. If the user is not logged in,
|
248
|
+
this will be set to the guest user
|
249
|
+
</p>
|
250
|
+
<p><a class="source-toggle" href="#"
|
251
|
+
onclick="toggleCode('M000284-source');return false;">[Source]</a></p>
|
252
|
+
<div class="method-source-code" id="M000284-source">
|
253
|
+
<pre>
|
254
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 13</span>
|
255
|
+
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_user</span>
|
256
|
+
14: <span class="ruby-ivar">@current_user</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
|
257
|
+
15: <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span> = (<span class="ruby-identifier">login_from_session</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">login_from_cookie</span> <span class="ruby-operator">||</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">guest</span>)
|
258
|
+
16: <span class="ruby-keyword kw">end</span>
|
259
|
+
17: <span class="ruby-keyword kw">end</span>
|
260
|
+
</pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div id="method-M000285" class="method-detail">
|
266
|
+
<a name="M000285"></a>
|
267
|
+
|
268
|
+
<div class="method-heading">
|
269
|
+
<a href="#M000285" class="method-signature">
|
270
|
+
<span class="method-name">current_user=</span><span class="method-args">(new_user)</span>
|
271
|
+
</a>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method-description">
|
275
|
+
<p>
|
276
|
+
Store the given user id in the session.
|
277
|
+
</p>
|
278
|
+
<p><a class="source-toggle" href="#"
|
279
|
+
onclick="toggleCode('M000285-source');return false;">[Source]</a></p>
|
280
|
+
<div class="method-source-code" id="M000285-source">
|
281
|
+
<pre>
|
282
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 20</span>
|
283
|
+
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_user=</span>(<span class="ruby-identifier">new_user</span>)
|
284
|
+
21: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>] = <span class="ruby-identifier">new_user</span> <span class="ruby-value">? </span><span class="ruby-identifier">new_user</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
|
285
|
+
22: <span class="ruby-ivar">@current_user</span> = <span class="ruby-identifier">new_user</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
|
286
|
+
23: <span class="ruby-ivar">@current_user</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>
|
287
|
+
24: <span class="ruby-keyword kw">end</span>
|
288
|
+
</pre>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div id="method-M000298" class="method-detail">
|
294
|
+
<a name="M000298"></a>
|
295
|
+
|
296
|
+
<div class="method-heading">
|
297
|
+
<a href="#M000298" class="method-signature">
|
298
|
+
<span class="method-name">handle_remember_cookie!</span><span class="method-args">(new_cookie_flag)</span>
|
299
|
+
</a>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
<div class="method-description">
|
303
|
+
<p>
|
304
|
+
Refresh the cookie auth token if it exists, create it otherwise
|
305
|
+
</p>
|
306
|
+
<p><a class="source-toggle" href="#"
|
307
|
+
onclick="toggleCode('M000298-source');return false;">[Source]</a></p>
|
308
|
+
<div class="method-source-code" id="M000298-source">
|
309
|
+
<pre>
|
310
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 172</span>
|
311
|
+
172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_remember_cookie!</span> <span class="ruby-identifier">new_cookie_flag</span>
|
312
|
+
173: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>
|
313
|
+
174: <span class="ruby-keyword kw">case</span>
|
314
|
+
175: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">valid_remember_cookie?</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">refresh_token</span> <span class="ruby-comment cmt"># keeping same expiry date</span>
|
315
|
+
176: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">new_cookie_flag</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">remember_me</span>
|
316
|
+
177: <span class="ruby-keyword kw">else</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">forget_me</span>
|
317
|
+
178: <span class="ruby-keyword kw">end</span>
|
318
|
+
179: <span class="ruby-identifier">send_remember_cookie!</span>
|
319
|
+
180: <span class="ruby-keyword kw">end</span>
|
320
|
+
</pre>
|
321
|
+
</div>
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div id="method-M000299" class="method-detail">
|
326
|
+
<a name="M000299"></a>
|
327
|
+
|
328
|
+
<div class="method-heading">
|
329
|
+
<a href="#M000299" class="method-signature">
|
330
|
+
<span class="method-name">kill_remember_cookie!</span><span class="method-args">()</span>
|
331
|
+
</a>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div class="method-description">
|
335
|
+
<p><a class="source-toggle" href="#"
|
336
|
+
onclick="toggleCode('M000299-source');return false;">[Source]</a></p>
|
337
|
+
<div class="method-source-code" id="M000299-source">
|
338
|
+
<pre>
|
339
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 182</span>
|
340
|
+
182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">kill_remember_cookie!</span>
|
341
|
+
183: <span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">:auth_token</span>
|
342
|
+
184: <span class="ruby-keyword kw">end</span>
|
343
|
+
</pre>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
<div id="method-M000283" class="method-detail">
|
349
|
+
<a name="M000283"></a>
|
350
|
+
|
351
|
+
<div class="method-heading">
|
352
|
+
<a href="#M000283" class="method-signature">
|
353
|
+
<span class="method-name">logged_in?</span><span class="method-args">()</span>
|
354
|
+
</a>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div class="method-description">
|
358
|
+
<p>
|
359
|
+
Returns true or false if the user is logged in. Preloads <a
|
360
|
+
href="../../User.html#M000017">User.current</a> with the user model if
|
361
|
+
they‘re logged in.
|
362
|
+
</p>
|
363
|
+
<p><a class="source-toggle" href="#"
|
364
|
+
onclick="toggleCode('M000283-source');return false;">[Source]</a></p>
|
365
|
+
<div class="method-source-code" id="M000283-source">
|
366
|
+
<pre>
|
367
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 7</span>
|
368
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">logged_in?</span>
|
369
|
+
8: <span class="ruby-operator">!</span><span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">guest?</span>
|
370
|
+
9: <span class="ruby-keyword kw">end</span>
|
371
|
+
</pre>
|
372
|
+
</div>
|
373
|
+
</div>
|
374
|
+
</div>
|
375
|
+
|
376
|
+
<div id="method-M000293" class="method-detail">
|
377
|
+
<a name="M000293"></a>
|
378
|
+
|
379
|
+
<div class="method-heading">
|
380
|
+
<a href="#M000293" class="method-signature">
|
381
|
+
<span class="method-name">login_from_basic_auth</span><span class="method-args">()</span>
|
382
|
+
</a>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
<div class="method-description">
|
386
|
+
<p>
|
387
|
+
Called from <a href="Controller.html#M000284">current_user</a>. Now,
|
388
|
+
attempt to login by basic authentication information.
|
389
|
+
</p>
|
390
|
+
<p><a class="source-toggle" href="#"
|
391
|
+
onclick="toggleCode('M000293-source');return false;">[Source]</a></p>
|
392
|
+
<div class="method-source-code" id="M000293-source">
|
393
|
+
<pre>
|
394
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 115</span>
|
395
|
+
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_from_basic_auth</span>
|
396
|
+
116: <span class="ruby-identifier">authenticate_with_http_basic</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">login</span>, <span class="ruby-identifier">password</span><span class="ruby-operator">|</span>
|
397
|
+
117: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_user</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">authenticate</span>(<span class="ruby-identifier">login</span>, <span class="ruby-identifier">password</span>)
|
398
|
+
118: <span class="ruby-keyword kw">end</span>
|
399
|
+
119: <span class="ruby-keyword kw">end</span>
|
400
|
+
</pre>
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
<div id="method-M000294" class="method-detail">
|
406
|
+
<a name="M000294"></a>
|
407
|
+
|
408
|
+
<div class="method-heading">
|
409
|
+
<a href="#M000294" class="method-signature">
|
410
|
+
<span class="method-name">login_from_cookie</span><span class="method-args">()</span>
|
411
|
+
</a>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
<div class="method-description">
|
415
|
+
<p>
|
416
|
+
Called from <a href="Controller.html#M000284">current_user</a>. Finaly,
|
417
|
+
attempt to login by an expiring token in the cookie. for the paranoid: we
|
418
|
+
<em>should</em> be storing user_token = hash(cookie_token, request IP)
|
419
|
+
</p>
|
420
|
+
<p><a class="source-toggle" href="#"
|
421
|
+
onclick="toggleCode('M000294-source');return false;">[Source]</a></p>
|
422
|
+
<div class="method-source-code" id="M000294-source">
|
423
|
+
<pre>
|
424
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 127</span>
|
425
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_from_cookie</span>
|
426
|
+
128: <span class="ruby-identifier">user</span> = <span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">:auth_token</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">find_by_remember_token</span>(<span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">:auth_token</span>])
|
427
|
+
129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">remember_token?</span>
|
428
|
+
130: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_user</span> = <span class="ruby-identifier">user</span>
|
429
|
+
131: <span class="ruby-identifier">handle_remember_cookie!</span> <span class="ruby-keyword kw">false</span> <span class="ruby-comment cmt"># freshen cookie token (keeping date)</span>
|
430
|
+
132: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_user</span>
|
431
|
+
133: <span class="ruby-keyword kw">end</span>
|
432
|
+
134: <span class="ruby-keyword kw">end</span>
|
433
|
+
</pre>
|
434
|
+
</div>
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
<div id="method-M000292" class="method-detail">
|
439
|
+
<a name="M000292"></a>
|
440
|
+
|
441
|
+
<div class="method-heading">
|
442
|
+
<a href="#M000292" class="method-signature">
|
443
|
+
<span class="method-name">login_from_session</span><span class="method-args">()</span>
|
444
|
+
</a>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
<div class="method-description">
|
448
|
+
<p>
|
449
|
+
Called from <a href="Controller.html#M000284">current_user</a>. First
|
450
|
+
attempt to login by the user id stored in the session.
|
451
|
+
</p>
|
452
|
+
<p><a class="source-toggle" href="#"
|
453
|
+
onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
|
454
|
+
<div class="method-source-code" id="M000292-source">
|
455
|
+
<pre>
|
456
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 110</span>
|
457
|
+
110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_from_session</span>
|
458
|
+
111: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current_user</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>]
|
459
|
+
112: <span class="ruby-keyword kw">end</span>
|
460
|
+
</pre>
|
461
|
+
</div>
|
462
|
+
</div>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
<div id="method-M000287" class="method-detail">
|
466
|
+
<a name="M000287"></a>
|
467
|
+
|
468
|
+
<div class="method-heading">
|
469
|
+
<a href="#M000287" class="method-signature">
|
470
|
+
<span class="method-name">login_required</span><span class="method-args">()</span>
|
471
|
+
</a>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
<div class="method-description">
|
475
|
+
<p>
|
476
|
+
Filter method to enforce a login requirement.
|
477
|
+
</p>
|
478
|
+
<p>
|
479
|
+
To require logins for all actions, use this in your controllers:
|
480
|
+
</p>
|
481
|
+
<pre>
|
482
|
+
before_filter :login_required
|
483
|
+
</pre>
|
484
|
+
<p>
|
485
|
+
To require logins for specific actions, use this in your controllers:
|
486
|
+
</p>
|
487
|
+
<pre>
|
488
|
+
before_filter :login_required, :only => [ :edit, :update ]
|
489
|
+
</pre>
|
490
|
+
<p>
|
491
|
+
To skip this in a subclassed controller:
|
492
|
+
</p>
|
493
|
+
<pre>
|
494
|
+
skip_before_filter :login_required
|
495
|
+
</pre>
|
496
|
+
<p><a class="source-toggle" href="#"
|
497
|
+
onclick="toggleCode('M000287-source');return false;">[Source]</a></p>
|
498
|
+
<div class="method-source-code" id="M000287-source">
|
499
|
+
<pre>
|
500
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 57</span>
|
501
|
+
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_required</span>
|
502
|
+
58: <span class="ruby-identifier">authorized?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">access_denied</span>
|
503
|
+
59: <span class="ruby-keyword kw">end</span>
|
504
|
+
</pre>
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
</div>
|
508
|
+
|
509
|
+
<div id="method-M000295" class="method-detail">
|
510
|
+
<a name="M000295"></a>
|
511
|
+
|
512
|
+
<div class="method-heading">
|
513
|
+
<a href="#M000295" class="method-signature">
|
514
|
+
<span class="method-name">logout_keeping_session!</span><span class="method-args">()</span>
|
515
|
+
</a>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
<div class="method-description">
|
519
|
+
<p>
|
520
|
+
This is ususally what you want; resetting the session willy-nilly wreaks
|
521
|
+
havoc with forgery protection, and is only strictly necessary on login.
|
522
|
+
However, **all session state variables should be unset here**.
|
523
|
+
</p>
|
524
|
+
<p><a class="source-toggle" href="#"
|
525
|
+
onclick="toggleCode('M000295-source');return false;">[Source]</a></p>
|
526
|
+
<div class="method-source-code" id="M000295-source">
|
527
|
+
<pre>
|
528
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 139</span>
|
529
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">logout_keeping_session!</span>
|
530
|
+
140: <span class="ruby-comment cmt"># Kill server-side auth cookie</span>
|
531
|
+
141: <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">forget_me</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">User</span>
|
532
|
+
142: <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-comment cmt"># not logged in, and don't do it for me</span>
|
533
|
+
143: <span class="ruby-identifier">kill_remember_cookie!</span> <span class="ruby-comment cmt"># Kill client-side auth cookie</span>
|
534
|
+
144: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:user_id</span>] = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># keeps the session but kill our variable</span>
|
535
|
+
145: <span class="ruby-comment cmt"># explicitly kill any other session variables you set</span>
|
536
|
+
146: <span class="ruby-keyword kw">end</span>
|
537
|
+
</pre>
|
538
|
+
</div>
|
539
|
+
</div>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
<div id="method-M000296" class="method-detail">
|
543
|
+
<a name="M000296"></a>
|
544
|
+
|
545
|
+
<div class="method-heading">
|
546
|
+
<a href="#M000296" class="method-signature">
|
547
|
+
<span class="method-name">logout_killing_session!</span><span class="method-args">()</span>
|
548
|
+
</a>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
<div class="method-description">
|
552
|
+
<p>
|
553
|
+
The session should only be reset at the tail end of a form POST —
|
554
|
+
otherwise the request forgery protection fails. It‘s only really
|
555
|
+
necessary when you cross quarantine (logged-out to logged-in).
|
556
|
+
</p>
|
557
|
+
<p><a class="source-toggle" href="#"
|
558
|
+
onclick="toggleCode('M000296-source');return false;">[Source]</a></p>
|
559
|
+
<div class="method-source-code" id="M000296-source">
|
560
|
+
<pre>
|
561
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 151</span>
|
562
|
+
151: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">logout_killing_session!</span>
|
563
|
+
152: <span class="ruby-identifier">logout_keeping_session!</span>
|
564
|
+
153: <span class="ruby-identifier">reset_session</span>
|
565
|
+
154: <span class="ruby-keyword kw">end</span>
|
566
|
+
</pre>
|
567
|
+
</div>
|
568
|
+
</div>
|
569
|
+
</div>
|
570
|
+
|
571
|
+
<div id="method-M000290" class="method-detail">
|
572
|
+
<a name="M000290"></a>
|
573
|
+
|
574
|
+
<div class="method-heading">
|
575
|
+
<a href="#M000290" class="method-signature">
|
576
|
+
<span class="method-name">redirect_back_or_default</span><span class="method-args">(default)</span>
|
577
|
+
</a>
|
578
|
+
</div>
|
579
|
+
|
580
|
+
<div class="method-description">
|
581
|
+
<p>
|
582
|
+
<a href="../../Redirect.html">Redirect</a> to the URI stored by the most
|
583
|
+
recent <a href="Controller.html#M000289">store_location</a> call or to the
|
584
|
+
passed default. Set an appropriately modified
|
585
|
+
</p>
|
586
|
+
<pre>
|
587
|
+
after_filter :store_location, :only => [:index, :new, :show, :edit]
|
588
|
+
</pre>
|
589
|
+
<p>
|
590
|
+
for any controller you want to be bounce-backable.
|
591
|
+
</p>
|
592
|
+
<p><a class="source-toggle" href="#"
|
593
|
+
onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
|
594
|
+
<div class="method-source-code" id="M000290-source">
|
595
|
+
<pre>
|
596
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 94</span>
|
597
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect_back_or_default</span>(<span class="ruby-identifier">default</span>)
|
598
|
+
95: <span class="ruby-identifier">redirect_to</span>(<span class="ruby-identifier">session</span>[<span class="ruby-identifier">:return_to</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>)
|
599
|
+
96: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:return_to</span>] = <span class="ruby-keyword kw">nil</span>
|
600
|
+
97: <span class="ruby-keyword kw">end</span>
|
601
|
+
</pre>
|
602
|
+
</div>
|
603
|
+
</div>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
<div id="method-M000300" class="method-detail">
|
607
|
+
<a name="M000300"></a>
|
608
|
+
|
609
|
+
<div class="method-heading">
|
610
|
+
<a href="#M000300" class="method-signature">
|
611
|
+
<span class="method-name">send_remember_cookie!</span><span class="method-args">()</span>
|
612
|
+
</a>
|
613
|
+
</div>
|
614
|
+
|
615
|
+
<div class="method-description">
|
616
|
+
<p><a class="source-toggle" href="#"
|
617
|
+
onclick="toggleCode('M000300-source');return false;">[Source]</a></p>
|
618
|
+
<div class="method-source-code" id="M000300-source">
|
619
|
+
<pre>
|
620
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 186</span>
|
621
|
+
186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_remember_cookie!</span>
|
622
|
+
187: <span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">:auth_token</span>] = {
|
623
|
+
188: <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">remember_token</span>,
|
624
|
+
189: <span class="ruby-identifier">:expires</span> =<span class="ruby-operator">></span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">remember_token_expires_at</span> }
|
625
|
+
190: <span class="ruby-keyword kw">end</span>
|
626
|
+
</pre>
|
627
|
+
</div>
|
628
|
+
</div>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
<div id="method-M000289" class="method-detail">
|
632
|
+
<a name="M000289"></a>
|
633
|
+
|
634
|
+
<div class="method-heading">
|
635
|
+
<a href="#M000289" class="method-signature">
|
636
|
+
<span class="method-name">store_location</span><span class="method-args">()</span>
|
637
|
+
</a>
|
638
|
+
</div>
|
639
|
+
|
640
|
+
<div class="method-description">
|
641
|
+
<p>
|
642
|
+
Store the URI of the current request in the session.
|
643
|
+
</p>
|
644
|
+
<p>
|
645
|
+
We can return to this location by calling <a
|
646
|
+
href="Controller.html#M000290">redirect_back_or_default</a>.
|
647
|
+
</p>
|
648
|
+
<p><a class="source-toggle" href="#"
|
649
|
+
onclick="toggleCode('M000289-source');return false;">[Source]</a></p>
|
650
|
+
<div class="method-source-code" id="M000289-source">
|
651
|
+
<pre>
|
652
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 86</span>
|
653
|
+
86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_location</span>
|
654
|
+
87: <span class="ruby-identifier">session</span>[<span class="ruby-identifier">:return_to</span>] = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_uri</span>
|
655
|
+
88: <span class="ruby-keyword kw">end</span>
|
656
|
+
</pre>
|
657
|
+
</div>
|
658
|
+
</div>
|
659
|
+
</div>
|
660
|
+
|
661
|
+
<div id="method-M000297" class="method-detail">
|
662
|
+
<a name="M000297"></a>
|
663
|
+
|
664
|
+
<div class="method-heading">
|
665
|
+
<a href="#M000297" class="method-signature">
|
666
|
+
<span class="method-name">valid_remember_cookie?</span><span class="method-args">()</span>
|
667
|
+
</a>
|
668
|
+
</div>
|
669
|
+
|
670
|
+
<div class="method-description">
|
671
|
+
<p>
|
672
|
+
Cookies shouldn‘t be allowed to persist past their freshness date,
|
673
|
+
and they should be changed at each login
|
674
|
+
</p>
|
675
|
+
<p><a class="source-toggle" href="#"
|
676
|
+
onclick="toggleCode('M000297-source');return false;">[Source]</a></p>
|
677
|
+
<div class="method-source-code" id="M000297-source">
|
678
|
+
<pre>
|
679
|
+
<span class="ruby-comment cmt"># File lib/cms/authentication/controller.rb, line 165</span>
|
680
|
+
165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_remember_cookie?</span>
|
681
|
+
166: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>
|
682
|
+
167: (<span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">remember_token?</span>) <span class="ruby-operator">&&</span>
|
683
|
+
168: (<span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">:auth_token</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">remember_token</span>)
|
684
|
+
169: <span class="ruby-keyword kw">end</span>
|
685
|
+
</pre>
|
686
|
+
</div>
|
687
|
+
</div>
|
688
|
+
</div>
|
689
|
+
|
690
|
+
|
691
|
+
</div>
|
692
|
+
|
693
|
+
|
694
|
+
</div>
|
695
|
+
|
696
|
+
|
697
|
+
<div id="validator-badges">
|
698
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
</body>
|
702
|
+
</html>
|